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+ private static final int BUCKETS = 1 ;
911 private short defaultValue = LongShortMap .DEFAULT_VALUE ;
1012
1113 private ConcurrentLongShortTreeMapBuilder () {
@@ -15,10 +17,6 @@ public static ConcurrentLongShortTreeMapBuilder newBuilder() {
1517 return new ConcurrentLongShortTreeMapBuilder ();
1618 }
1719
18- public ConcurrentLongShortTreeMapBuilder withBuckets (int buckets ) {
19- this .buckets = buckets ;
20- return this ;
21- }
2220
2321 public ConcurrentLongShortTreeMapBuilder withMode (MapMode mapMode ) {
2422 this .mapMode = mapMode ;
@@ -39,15 +37,15 @@ public enum MapMode {
3937 @ Override
4038 LongShortTreeMap createMap (ConcurrentLongShortTreeMapBuilder builder ) {
4139 return new ConcurrentBusyWaitingLongShortTreeMap (
42- builder . buckets ,
40+ BUCKETS ,
4341 builder .defaultValue );
4442 }
4543 },
4644 BLOCKING {
4745 @ Override
4846 LongShortTreeMap createMap (ConcurrentLongShortTreeMapBuilder builder ) {
4947 return new ConcurrentLongShortTreeMap (
50- builder . buckets ,
48+ BUCKETS ,
5149 builder .defaultValue );
5250 }
5351 };
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