Mercurial > projects > dwt2
comparison java/src/java/util/AbstractList.d @ 10:eb8ff453285d
Added java.util collection classes.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 13 Mar 2009 16:57:07 +0100 |
parents | |
children | 9b96950f2c3c |
comparison
equal
deleted
inserted
replaced
9:950d84783eac | 10:eb8ff453285d |
---|---|
1 module java.util.AbstractList; | |
2 | |
3 import java.lang.all; | |
4 import java.util.Collection; | |
5 import java.util.AbstractCollection; | |
6 import java.util.List; | |
7 import java.util.ListIterator; | |
8 import java.util.Iterator; | |
9 | |
10 abstract class AbstractList : AbstractCollection, List { | |
11 this(){ | |
12 } | |
13 | |
14 public abstract void add(int index, Object element); | |
15 public abstract bool add(Object o); | |
16 public abstract bool addAll(Collection c); | |
17 public abstract bool addAll(int index, Collection c); | |
18 public abstract void clear(); | |
19 public abstract bool contains(Object o); | |
20 public bool contains(String str){ | |
21 return contains(stringcast(str)); | |
22 } | |
23 public abstract bool containsAll(Collection c); | |
24 public abstract int opEquals(Object o); | |
25 public abstract Object get(int index); | |
26 | |
27 public hash_t toHash(){ | |
28 // http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html#hashCode() | |
29 hash_t hashCode = 1; | |
30 Iterator i = iterator(); | |
31 while (i.hasNext()) { | |
32 Object obj = i.next(); | |
33 hashCode = 31 * hashCode + (obj is null ? 0 : obj.toHash()); | |
34 } | |
35 return hashCode; | |
36 } | |
37 | |
38 public abstract int indexOf(Object o); | |
39 public abstract bool isEmpty(); | |
40 public abstract Iterator iterator(); | |
41 public abstract int lastIndexOf(Object o); | |
42 public abstract ListIterator listIterator(); | |
43 public abstract ListIterator listIterator(int index); | |
44 public abstract Object remove(int index); | |
45 protected abstract void removeRange(int fromIndex, int toIndex); | |
46 public abstract bool remove(Object o); | |
47 public abstract bool remove(String o); | |
48 public abstract bool removeAll(Collection c); | |
49 public abstract bool retainAll(Collection c); | |
50 public abstract Object set(int index, Object element); | |
51 public abstract List subList(int fromIndex, int toIndex); | |
52 public abstract Object[] toArray(); | |
53 public abstract Object[] toArray(Object[] a); | |
54 | |
55 } | |
56 |