在ubuntu编译java程序时报错:type Iterator does not take parameters

源码如下:

package object;
import java.util.*;
class Generate{
Map<Integer,String> map = new HashMap<Integer, String>();
{
map.put(,"mother");
map.put(,"wife");
map.put(,"father");
}
public String next()
{
Random rand = new Random();
int i = rand.nextInt() + ;
return map.get(i);
}
} public class Iterator1{
public static void main(String[] args)
{
Generate g = new Generate();
Collection<String> cll = new ArrayList<String>();
for( int i = ; i < ; i++)
cll.add(g.next());
Iterator<String> iterator = cll.iterator();
while(iterator.hasNext())
System.out.println(iterator.next());
System.out.println();
}
}

报错原因:包里面有之前编写的一个Iterator类,编译时优先调用了包里的Iterator而没有调用java.util里面的Iterator

type Iterator does not take parameters的更多相关文章

  1. 【异常及源码分析】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping

    一.异常出现的场景 1)异常出现的SQL @Select("SELECT\n" + " id,discount_type ,min_charge, ${cardFee} ...

  2. java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).

    java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2). java. ...

  3. Go语言设计模式实践:迭代器(Iterator)

    关于本系列 决定开个新坑. 这个系列首先是关于Go语言实践的.在项目中实际使用Go语言也有段时间了,一个体会就是不论是官方文档.图书还是网络资料,关于Go语言惯用法(idiom)的介绍都比较少,基本只 ...

  4. Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameter 标签: 构造器注入Spring

    问题:要么是因为构造方法改变了,要么就是构造方法入参实例化失败(比如没有实现) 问题 在练习spring构造器注入方式的小程序的时候报错: Exception in thread “main” org ...

  5. [LeetCode] 284. Peeking Iterator 瞥一眼迭代器

    Given an Iterator class interface with methods: next() and hasNext(), design and implement a Peeking ...

  6. Unable to resolve service for type 'Microsoft.AspNetCore.Http.IHttpContextAccessor'

    An unhandled exception occurred while processing the request. InvalidOperationException: Unable to r ...

  7. PARAMETERS对象

    1. PARAMETERS的基本语法及定义 PARAMETERS可以参照数据字典字段或自定义数据类型创建文本输入域及单选框/复选框等, PARAMETERS只能创建一个单一的输入域且最多只能输入行,其 ...

  8. Iterator Protocol - Python 描述符协议

    Iterator Protocol - Python 描述符协议 先看几个有关概念, iterator 迭代器, 一个实现了无参数的 __next__ 方法, 并返回 '序列'中下一个元素,在没有更多 ...

  9. 【LeetCode】284. Peeking Iterator 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/peeking-i ...

随机推荐

  1. opencv 应用程序无法正常启动(0xooooo7b)

    #include<iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui ...

  2. ECharts.js 简单示例

    ECharts.js学习(一) 简单入门 EChart.js 简单入门 最近有一个统计的项目要做,在前端的数据需要用图表的形式展示.网上搜索了一下,发现有几种统计图库. MSChart   这个是Vi ...

  3. PostgreSQL 修改字段类型从int到bigint

    由于现在pg的版本,修改int到bigint仍然需要rewrite表,会导致表阻塞,无法使用.但可以考虑其他方式来做.此问题是排查现网pg使用序列的情况时遇到的. 由于int的最大值只有21亿左右,而 ...

  4. web页面的绝对路径

    在JavaWeb开发中,常使用绝对路径的方式来引入JavaScript和CSS文件,这样可以避免因为目录变动导致引入文件找不到的情况,常用的做法如下:一.使用${pageContext.request ...

  5. Chapter 7(图)

    1.Prim算法生成最小生成树 //Prim算法生成最小生成树 void MiniSpanTree_Prim(MGraph G) { int min,i,j,k; int adjvex[MAXVEX] ...

  6. Java入门:注册模块的实现

    1.主活动图 用户选择注册选项,进入注册界面,开始输入注册信息,到最后完成注册.具体的活动图如下: 以上活动图中,矩形框里的操作不是在一个类里面实现的,而是通过Form类和UserService类来实 ...

  7. 利用oneproxy实现mysql读写分离搭建笔记

      功能: 1.具有SQL白名单(防SQL注入)及IP白名单功能的SQL防火墙软件 2.数据库故障切换 3.读写分离 4.分库分表     一.下载 官网下载:http://www.onexsoft. ...

  8. (转)Python中的generator详解

    本文转自:http://www.cnblogs.com/xybaby/p/6322376.html 作者:xybaby 注:本文在原文基础上做了一点点修改,仅仅作为个人理解与记忆,建议直接查看原文. ...

  9. Hadoop生态圈-使用MapReduce处理HBase数据

    Hadoop生态圈-使用MapReduce处理HBase数据 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.对HBase表中数据进行单词统计(TableInputFormat) ...

  10. 大数据时代快速SQL引擎-Impala

    背景 随着大数据时代的到来,Hadoop在过去几年以接近统治性的方式包揽的ETL和数据分析查询的工作,大家也无意间的想往大数据方向靠拢,即使每天数据也就几十.几百M也要放到Hadoop上作分析,只会适 ...