Some small classpath tweaks to be compatible with openJDK's api

This commit is contained in:
Mike Jensen 2014-12-15 16:26:41 -07:00
parent a53ffc1792
commit 32a1fb21f2
5 changed files with 40 additions and 2 deletions

View File

@ -38,7 +38,11 @@ public class Collections {
public static void sort(List list) {
sort(list, new Comparator() {
public int compare(Object a, Object b) {
return ((Comparable) a).compareTo(b);
if (a instanceof Comparable) {
return ((Comparable) a).compareTo(b);
} else {
return a.hashCode() - b.hashCode();
}
}
});
}

View File

@ -49,6 +49,14 @@ public class ConcurrentHashMap<K,V>
this();
}
public ConcurrentHashMap(int initialCapacity, float loadFactor) {
this();
}
public ConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel) {
this();
}
public boolean isEmpty() {
return content.size == 0;
}

View File

@ -10,6 +10,6 @@
package java.util.concurrent;
public interface Delayed {
public interface Delayed extends Comparable<Delayed> {
public long getDelay(TimeUnit unit);
}

View File

@ -14,6 +14,8 @@ import java.util.Collection;
public interface ExecutorService extends Executor {
public void shutdown();
public List<Runnable> shutdownNow();
public boolean isShutdown();

View File

@ -0,0 +1,24 @@
/* Copyright (c) 2008-2014, 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.concurrent;
public class Executors {
public static <T> Callable<T> callable(final Runnable task, final T result) {
return new Callable<T>() {
@Override
public T call() throws Exception {
task.run();
return result;
}
};
}
}