mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
fun with collections
This commit is contained in:
37
classpath/java/util/Arrays.java
Normal file
37
classpath/java/util/Arrays.java
Normal file
@ -0,0 +1,37 @@
|
||||
package java.util;
|
||||
|
||||
public class Arrays {
|
||||
private Arrays() { }
|
||||
|
||||
public static <T> List<T> asList(final T ... array) {
|
||||
return new List<T>() {
|
||||
public int size() {
|
||||
return array.length;
|
||||
}
|
||||
|
||||
public boolean add(T element) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public T get(int index) {
|
||||
return array[index];
|
||||
}
|
||||
|
||||
public T remove(int index) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean remove(T element) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Iterator<T> iterator() {
|
||||
return new Collections.ArrayListIterator(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user