Commit Graph

39 Commits

Author SHA1 Message Date
Mike Jensen
7baa5243b0 Add Collections.synchronizedList to classpath 2014-12-12 11:35:39 -07:00
Joel Dice
9b7d0d1624 update copyright years 2014-04-23 15:33:41 -06:00
Joel Dice
c0d178d5f1 implement ConcurrentHashMap and AtomicReferenceArray
This is the simplest possible ConcurrentHashMap I could come up with
that works and is actually concurrent in the way one would expect.
It's pretty unconventional, being based on a persistent red-black
tree, and not particularly memory-efficient or cache-friendly.  I
think this is a good place to start, though, and it should perform
reasonably well for most workloads.  Patches for a more efficient
implementation are welcome!

I also implemented AtomicReferenceArray, since I was using it in my
first, naive attempt to implement ConcurrentHashMap.

I had to do a bit of refactoring, including moving some non-standard
stuff from java.util.Collections to avian.Data so I could make it
available to code outside the java.util package, which is why I had to
modify several unrelated files.
2014-03-12 10:44:24 -06:00
Johannes Schindelin
eab3b8e448 Implement Collections#reverse
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 14:33:25 -06:00
Johannes Schindelin
a61bcf824f Implement Collections#binarySearch
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 14:33:25 -06:00
Johannes Schindelin
d37b5ada37 Implement Collections#sort
This is really a verbatim translation of Arrays#sort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 12:08:22 -06:00
Johannes Schindelin
056c65947e Add Collections#singletonList
This is a very dumb implementation that wastes space and time by
constructing a full-blown ArrayList as backend. However, it is
better to have a dumb implementation than none at all, and we can
always do something about the performance when, and if, that should
become necessary.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
86c735e649 Add Collections#synchronizedSet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Mike Jensen
bfe7b9110a Removed exception message based on Josh's recommendation 2013-07-17 11:52:48 -06:00
Mike Jensen
7da59277e5 This solves a class cast exception from a call to .values() from an UnmodifiableMap. It also solves an issue where you can modify an unmodifiable collection through the Iterator or ListIterator (depending on the structure type). 2013-07-15 08:54:44 -06:00
Joel Dice
87b02eb949 update copyright years
Previously, I used a shell script to extract modification date ranges
from the Git history, but that was complicated and unreliable, so now
every file just gets the same year range in its copyright header.  If
someone needs to know when a specific file was modified and by whom,
they can look at the Git history themselves; no need to include it
redundantly in the header.
2013-07-02 20:52:38 -06:00
Mike Jensen
a41f8c0103 Added more to the avian classpath for the collection interface as well as the list interface
Added to collection:
public boolean containsAll(Collection<?> c);
public boolean removeAll(Collection<?> c);

Added to list:
public boolean addAll(int startIndex, Collection<? extends T> c);

Also where possible for inner classes I made them extend the abstract version instead of just implement the interface.  This helps reduce code duplication where possible.

These changes were necessary to support protobuf 2.5.0
2013-04-29 11:32:56 -06:00
Joel Dice
0addd8c814 update copyright years 2012-05-11 17:43:27 -06:00
Topher Lamey
9aae57ee03 Additions for Protobuf support 2011-06-17 11:23:09 -06:00
Joel Dice
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
Joel Dice
580e7e1b3f remove @Overload annotation since Java 1.5.0_19 chokes on it 2010-11-07 12:57:42 -07:00
Zsombor Gegesy
5dadac2cb8 API additions for compatibility with harmony's java.util package 2010-09-11 21:23:46 +02:00
Zsombor Gegesy
03b66375f4 add Collections.enumeration(Collection<T> c) 2010-08-16 09:23:48 -06:00
Joel Dice
0a7f94abfe add java.util.Collection.toArray() 2009-08-04 17:36:25 -06:00
Joel Dice
7911989055 add AbstractList and AbstractSequentialList classes to java.util and listIterator methods to java.util.List 2009-08-04 17:24:29 -06:00
Joel Dice
d327f6ba5a implement java.util.TreeMap 2009-07-25 15:41:43 -06:00
mweaver
6b89ecd0ee Like a noob, I missed some things... broke the compilation. 2009-04-22 15:24:26 -06:00
Eric Scharff
af784f4cbc "Fix" Map.containsKey() and Map.containsValue()
java.util.Map.containsKey() and java.util.Map.containsValue() take
Object parameters, not K and V.  Changed to improve classpath
compatibility.
2009-04-17 08:57:49 -06:00
Joel Dice
d1018bf078 update copyright years 2009-03-15 12:02:36 -06:00
Joel Dice
1d04fed6de implement Collections.shuffle 2009-03-04 08:18:18 -07:00
Zsombor
d682ccaceb add synchronized map 2009-02-16 17:52:27 -07:00
Eric Scharff
bba4f75c2f Tweaked code indentation and formatting to match existing style 2008-07-03 10:49:08 -06:00
Zsombor
e3fd0d9c7d add a few classes and methods to the classpath
Add java.lang.CharSequence, java.util.AbstractSet,
java.util.AbstractCollection, Collections.unmodifiableSet,
 System.getProperty(String,String), etc.
2008-07-03 09:16:32 -06:00
Joel Dice
3e7acd7861 fix backwards logic in Collections.toArray 2008-03-05 14:21:53 -07:00
Joel Dice
9d76d6a04e implement a few more classpath methods, including Collection.addAll and Collection.toArray 2008-02-28 11:37:10 -07:00
Joel Dice
2edaa82801 prepend copyright notice and license to all source files; add license.txt and readme.txt 2008-02-19 11:06:52 -07:00
Joel Dice
707359d555 remove redundant synchronization from Collections.SynchronizedCollection 2008-01-28 08:10:23 -07:00
Joel Dice
fef3cddb9e fix build breakage due to missing isEmpty() methods 2007-11-07 09:48:09 -07:00
Joel Dice
f84b865f03 implement TreeSet.toString() 2007-10-16 19:17:37 -06:00
Eric Scharff
0beba6cafa ArrayList now implements ListIterator (for reverse traversals of lists) 2007-09-26 09:48:59 -06:00
Eric Scharff
876b02f641 Added method addAll to interface Map 2007-09-26 09:19:21 -06:00
Joel Dice
d1dbb45d55 implement Arrays.toString() 2007-08-23 19:57:42 -06:00
Joel Dice
472ecb1713 flesh out some classpath classes 2007-07-22 13:06:21 -06:00
Joel Dice
ecd31a10a4 fun with collections 2007-07-21 21:47:29 -06:00