File tree Expand file tree Collapse file tree
main/java/com/trivago/fastutilconcurrentwrapper
test/java/com/trivago/fastutilconcurrentwrapper Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66public final class ConcurrentLongShortTreeMapBuilder {
77 private MapMode mapMode = MapMode .BLOCKING ;
8- private int buckets = 8 ;
8+ // floorEntry() requires all keys to reside in a single bucket to return
9+ // correct results, so the bucket count is fixed at 1.
10+ // ToDo: Identify a bucketing methodology that works for TreeMap
11+ private static final int BUCKETS = 1 ;
912 private short defaultValue = LongShortMap .DEFAULT_VALUE ;
1013
1114 private ConcurrentLongShortTreeMapBuilder () {
@@ -15,10 +18,6 @@ public static ConcurrentLongShortTreeMapBuilder newBuilder() {
1518 return new ConcurrentLongShortTreeMapBuilder ();
1619 }
1720
18- public ConcurrentLongShortTreeMapBuilder withBuckets (int buckets ) {
19- this .buckets = buckets ;
20- return this ;
21- }
2221
2322 public ConcurrentLongShortTreeMapBuilder withMode (MapMode mapMode ) {
2423 this .mapMode = mapMode ;
@@ -39,15 +38,15 @@ public enum MapMode {
3938 @ Override
4039 LongShortTreeMap createMap (ConcurrentLongShortTreeMapBuilder builder ) {
4140 return new ConcurrentBusyWaitingLongShortTreeMap (
42- builder . buckets ,
41+ BUCKETS ,
4342 builder .defaultValue );
4443 }
4544 },
4645 BLOCKING {
4746 @ Override
4847 LongShortTreeMap createMap (ConcurrentLongShortTreeMapBuilder builder ) {
4948 return new ConcurrentLongShortTreeMap (
50- builder . buckets ,
49+ BUCKETS ,
5150 builder .defaultValue );
5251 }
5352 };
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ public class ConcurrentLongShortTreeMapBuilderTest {
1313 @ Test
1414 public void buildsBusyWaitingMap () {
1515 ConcurrentLongShortTreeMapBuilder b = ConcurrentLongShortTreeMapBuilder .newBuilder ()
16- .withBuckets (2 )
1716 .withDefaultValue (DEFAULT_VALUE )
1817 .withMode (ConcurrentLongShortTreeMapBuilder .MapMode .BUSY_WAITING );
1918 LongShortTreeMap map = b .build ();
@@ -27,7 +26,6 @@ public void buildsBusyWaitingMap() {
2726 @ Test
2827 public void buildsBlockingMap () {
2928 ConcurrentLongShortTreeMapBuilder b = ConcurrentLongShortTreeMapBuilder .newBuilder ()
30- .withBuckets (2 )
3129 .withDefaultValue (DEFAULT_VALUE )
3230 .withMode (ConcurrentLongShortTreeMapBuilder .MapMode .BLOCKING );
3331 LongShortTreeMap map = b .build ();
You can’t perform that action at this time.
0 commit comments