Skip to content

Commit 61b0d6d

Browse files
author
Matthias Güdemann
authored
Merge pull request #1666 from mgudemann/bugfix/removed_required_virtual_calls
[TG-1523] fix removed required virtual calls
2 parents fabc99e + 3365054 commit 61b0d6d

17 files changed

+152
-11
lines changed
Binary file not shown.
Binary file not shown.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
public abstract class AbstractList<E>
2+
implements List<E>
3+
{
4+
public Iterator<E> iterator() {
5+
return new Itr();
6+
}
7+
8+
public ListIterator<E> listIterator() {
9+
return listIterator(0);
10+
}
11+
12+
public boolean equals(Object o) {
13+
if (o == this)
14+
return true;
15+
if (!(o instanceof List))
16+
return false;
17+
18+
ListIterator<E> e1 = listIterator();
19+
ListIterator<?> e2 = ((List<?>) o).listIterator();
20+
while (e1.hasNext() && e2.hasNext()) {
21+
E o1 = e1.next();
22+
Object o2 = e2.next();
23+
if (!(o1==null ? o2==null : o1.equals(o2)))
24+
return false;
25+
}
26+
return !(e1.hasNext() || e2.hasNext());
27+
}
28+
29+
private class Itr implements Iterator<E> {
30+
Itr() {
31+
}
32+
33+
public boolean hasNext() {
34+
return false;
35+
}
36+
37+
public E next() {
38+
return null;
39+
}
40+
41+
}
42+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
public class ArrayList<E> extends AbstractList<E>
2+
implements List<E>
3+
{
4+
public ListIterator<E> listIterator() {
5+
return new ListItr(0);
6+
}
7+
public ListIterator<E> listIterator(int index) {
8+
return new ListItr(index);
9+
}
10+
private class ListItr extends Itr implements ListIterator<E> {
11+
ListItr(int index) {
12+
super();
13+
}
14+
15+
public boolean hasPrevious() {
16+
return false;
17+
}
18+
}
19+
20+
private class Itr implements Iterator<E> {
21+
Itr() {
22+
}
23+
24+
public boolean hasNext() {
25+
return false;
26+
}
27+
public E next() {
28+
return null;
29+
}
30+
}
31+
}
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class ArrayListEquals {
2+
3+
public int check2(ArrayList<Integer> l1) {
4+
ArrayList<Integer> al = new ArrayList<Integer>();
5+
if(l1.equals(al))
6+
return 1;
7+
else
8+
return 0;
9+
}
10+
11+
}
Binary file not shown.

0 commit comments

Comments
 (0)