mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
API additions for compatibility with harmony's java.util package
This commit is contained in:
parent
fc2c6d5100
commit
5dadac2cb8
@ -79,6 +79,10 @@ public class ObjectInputStream extends InputStream {
|
||||
read('d');
|
||||
return readDoubleToken();
|
||||
}
|
||||
|
||||
public void defaultReadObject() throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void skipSpace() throws IOException {
|
||||
int c;
|
||||
|
@ -82,6 +82,10 @@ public class ObjectOutputStream extends OutputStream {
|
||||
out.print(v);
|
||||
}
|
||||
|
||||
public void defaultWriteObject() throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void writeObject(Object o, IdentityHashMap<Object, Integer> map,
|
||||
int nextId)
|
||||
throws IOException
|
||||
|
@ -148,5 +148,11 @@ public class Arrays {
|
||||
array[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void fill(T[] array, T value) {
|
||||
for (int i=0;i<array.length;i++) {
|
||||
array[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
package java.util;
|
||||
|
||||
public class Collections {
|
||||
|
||||
private Collections() { }
|
||||
|
||||
public static void shuffle(List list, Random random) {
|
||||
@ -84,6 +85,10 @@ public class Collections {
|
||||
return new IteratorEnumeration<T> (c.iterator());
|
||||
}
|
||||
|
||||
public static <T> Comparator<T> reverseOrder(Comparator<T> cmp) {
|
||||
return new ReverseComparator<T>(cmp);
|
||||
}
|
||||
|
||||
static class IteratorEnumeration<T> implements Enumeration<T> {
|
||||
private final Iterator<T> it;
|
||||
|
||||
@ -379,4 +384,20 @@ public class Collections {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ReverseComparator<T> implements Comparator<T> {
|
||||
|
||||
Comparator<T> cmp;
|
||||
|
||||
public ReverseComparator(Comparator<T> cmp) {
|
||||
this.cmp = cmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return - cmp.compare(o1, o2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
47
classpath/java/util/ConcurrentModificationException.java
Normal file
47
classpath/java/util/ConcurrentModificationException.java
Normal file
@ -0,0 +1,47 @@
|
||||
/* Copyright (c) 2010, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* @author zsombor
|
||||
*
|
||||
*/
|
||||
public class ConcurrentModificationException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public ConcurrentModificationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public ConcurrentModificationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public ConcurrentModificationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ConcurrentModificationException() {
|
||||
}
|
||||
|
||||
}
|
@ -269,8 +269,10 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(V value) {
|
||||
public V setValue(V value) {
|
||||
V old = this.value;
|
||||
this.value = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
public HashMap.Cell<K, V> next() {
|
||||
|
@ -40,6 +40,6 @@ public interface Map<K, V> {
|
||||
|
||||
public V getValue();
|
||||
|
||||
public void setValue(V value);
|
||||
public V setValue(V value);
|
||||
}
|
||||
}
|
||||
|
@ -112,9 +112,12 @@ public class TreeMap<K,V> implements Map<K,V> {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(V value) {
|
||||
public V setValue(V value) {
|
||||
V old = this.value;
|
||||
this.value = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class KeySet implements Set<K> {
|
||||
|
@ -114,8 +114,10 @@ public class WeakHashMap<K, V> implements Map<K, V> {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(V value) {
|
||||
public V setValue(V value) {
|
||||
V old = this.value;
|
||||
this.value = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
public HashMap.Cell<K, V> next() {
|
||||
|
Loading…
Reference in New Issue
Block a user