Commit Graph

32 Commits

Author SHA1 Message Date
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
58ea1442fd Implement LinkedHashMap
This implementation is intentionally simple. If and when the need arises,
we can always implement a more performant version.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:19 -06:00
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
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
a5742f5985 update copyright years 2010-12-05 20:21:09 -07:00
f9197cb076 fix a few HashMap bugs
1. HashMap.containsValue only checked one hash bucket, which was
 pretty much useless :)

 2. HashMap.MyIterator.remove was broken in that it failed to
 decrement the size field and it did not update the previousCell field
 properly, which sometimes led to more than one cell being removed.
2010-11-21 17:26:17 -07:00
5dadac2cb8 API additions for compatibility with harmony's java.util package 2010-09-11 21:23:46 +02:00
6118792ffd update copyright years 2009-12-02 19:08:29 -07:00
6475beda83 don't null out array in HashMap when size drops to zero
As in ArrayList, we want to avoid thrashing in cases where the map is frequently emptied and refilled.
2009-11-19 12:55:53 -07:00
0a7f94abfe add java.util.Collection.toArray() 2009-08-04 17:36:25 -06:00
d327f6ba5a implement java.util.TreeMap 2009-07-25 15:41:43 -06:00
6b89ecd0ee Like a noob, I missed some things... broke the compilation. 2009-04-22 15:24:26 -06:00
34da6da3db brought in line with Sun's SDK, should no longer break on values call 2009-04-22 10:04:38 -06:00
35d4d19c07 Merge branch 'master' of oss:/var/local/git/avian 2008-02-28 11:37:14 -07:00
9d76d6a04e implement a few more classpath methods, including Collection.addAll and Collection.toArray 2008-02-28 11:37:10 -07:00
73e7bfc1dc Added constructor for java.util.HashMap 2008-02-28 08:33:52 -07:00
2edaa82801 prepend copyright notice and license to all source files; add license.txt and readme.txt 2008-02-19 11:06:52 -07:00
fef3cddb9e fix build breakage due to missing isEmpty() methods 2007-11-07 09:48:09 -07:00
64313aa243 fix return value of HashMap.put() 2007-10-13 15:46:20 -06:00
15d1fe8b75 Fix hashmap insertion bug (entire bucket was getting erased in some put() operations) 2007-10-11 17:03:51 -06:00
876b02f641 Added method addAll to interface Map 2007-09-26 09:19:21 -06:00
b02b98609e Added methods isEmpty(), putAll(), toArray() to interfaces List and Map 2007-09-26 08:57:34 -06:00
27c8511c5e bugfixes 2007-08-20 18:24:54 -06:00
f22dda0df1 bugfixes 2007-08-14 19:14:55 -06:00
d0e519d992 bugfixes 2007-08-13 19:44:47 -06:00
ab3ca38580 various bugfixes 2007-08-13 18:37:00 -06:00
c20219df19 flesh out serialization/deserialization code and fix build 2007-08-12 18:50:25 -06:00
92ba1880d8 sketch of serialization/deserialization code (broken) 2007-08-12 15:01:47 -06:00
472ecb1713 flesh out some classpath classes 2007-07-22 13:06:21 -06:00
da17490206 fun with collections 2007-07-21 21:47:08 -06:00
90d60b3459 more classpath classes 2007-07-21 16:36:51 -06:00
fd770fd884 sketch a few more classpath classes 2007-07-21 14:44:39 -06:00