简体   繁体   中英

The code our Teacher gave us has an error in it. It's on the line public class MyArrayList<E> extends AbstractList<E>

The code my Teacher gave me has an error in it. I get this error on MyArrayList :

Duplicate methods named spliterator with the parameters () and () are inherited from the types Collection and Iterable

Why does it not work for me but it works for other students?

import java.util.*;

public class MyArrayList<E> extends AbstractList<E> 
{
private E[] data_store = (E[])new Object[50];
private int how_many = 0;

The only reason I can think of is the mismatch of Java version that the code was compiled with what you have setup in your environment.

Another reason could be that you are using an older version of IDE that does not support Java 8. For example, eclipse versions prior to Luna do not fully support Java 8 (Others correct me here if I got my facts wrong).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM