在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. nodejs进程异常退出处理方法

    1. 捕获uncaughtException process.on('uncaughtException', function (err) { //打印出错误 console.log(err); // ...

  2. c++优先队列(堆)

    1.最小堆.最大堆 priority_queue<int,vector<int>,greater<int> > f; //最小堆(后面的数逐渐greater) pr ...

  3. Python pytagcloud 中文分词 生成标签云 系列(一)

    转载地址:https://zhuanlan.zhihu.com/p/20432734工具 Python 2.7 (前几天试了试 Scrapy 所以用的 py2 .血泪的教训告诉我们能用 py3 千万别 ...

  4. 【Asp.net入门16】第一个ASP.NET 应用程序-总结

    本章创建了一个新的ASP.NET项目,并用它创建了一个简单的数据输入应用程序,向你初步介绍 了ASP.NET平台.本章省略了许多重要的功能,只为向你说明ASP.NET应用程序所执行的核心操作—— 使用 ...

  5. 源码中transient的用途

    Java的serialization提供了一种持久化对象实例的机制.当持久化对象时,可能有一个特殊的对象数据成员,我们不想用serialization机制来保存它.为了在一个特定对象的一个域上关闭se ...

  6. Codeforces 877 C. Slava and tanks

    http://codeforces.com/problemset/problem/877/C   C. Slava and tanks time limit per test 2 seconds me ...

  7. SHA-1(安全哈希算法实现)

    如题,不知道sha-1的自己百度吧. #include <iostream> #include <vector> //定义vector数组 #include <strin ...

  8. soj1046. Plane Spotting

    1046. Plane Spotting Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Craig is fond o ...

  9. 【转】 jquery easyui Tab 引入页面的问题

    原地址:http://blog.csdn.net/superdog007/article/details/8225518 jQuery Easyui 的tabs插件有两种方式加载某个tab(标签页)上 ...

  10. Python Pool

    我们在使用Python时,会经常需要使用多进程/多线程的情况,以便提高程序的运行效率,尤其是跟网络进行交互,如使用爬虫时.下面我们将简单看下Python的进程池的创建,map().apply_asyn ...