Skip to content

Commit 613468d

Browse files
author
nicolaiparlog
committed
Rename 'EqualityTransformingBuilder' to 'EqualityTransformingCollectionBuilder'
1 parent 3b5c3a8 commit 613468d

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/main/java/org/codefx/libfx/collection/transform/EqualityTransformingBuilder.java renamed to src/main/java/org/codefx/libfx/collection/transform/EqualityTransformingCollectionBuilder.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
* @param <E>
3636
* the type of elements maintained by the created set or keys by the created map.
3737
*/
38-
public class EqualityTransformingBuilder<E> {
38+
public class EqualityTransformingCollectionBuilder<E> {
3939

4040
private final Class<? super E> outerKeyTypeToken;
4141
private BiPredicate<? super E, ? super E> equals;
4242
private ToIntFunction<? super E> hash;
4343

44-
private EqualityTransformingBuilder(Class<? super E> outerKeyTypeToken) {
44+
private EqualityTransformingCollectionBuilder(Class<? super E> outerKeyTypeToken) {
4545
this.outerKeyTypeToken = outerKeyTypeToken;
4646
// note that the methods from 'Objects' already implement the contract for null-safety
4747
// imposed by the transforming set and map
@@ -65,8 +65,8 @@ private EqualityTransformingBuilder(Class<? super E> outerKeyTypeToken) {
6565
* the type of elements contained in the set created by the builder
6666
* @return a new builder
6767
*/
68-
public static <E> EqualityTransformingBuilder<E> forUnspecifiedKeyType() {
69-
return new EqualityTransformingBuilder<>(Object.class);
68+
public static <E> EqualityTransformingCollectionBuilder<E> forUnspecifiedKeyType() {
69+
return new EqualityTransformingCollectionBuilder<>(Object.class);
7070
}
7171

7272
/**
@@ -80,17 +80,17 @@ public static <E> EqualityTransformingBuilder<E> forUnspecifiedKeyType() {
8080
* a type token for the elements contained in the set created by the builder
8181
* @return a new builder
8282
*/
83-
public static <E> EqualityTransformingBuilder<E> forKeyType(Class<? super E> keyTypeToken) {
83+
public static <E> EqualityTransformingCollectionBuilder<E> forKeyType(Class<? super E> keyTypeToken) {
8484
Objects.requireNonNull(keyTypeToken, "The argument 'keyTypeToken' must not be null.");
85-
return new EqualityTransformingBuilder<>(keyTypeToken);
85+
return new EqualityTransformingCollectionBuilder<>(keyTypeToken);
8686
}
8787

8888
/**
8989
* @param equals
9090
* a function determining equality of keys; might be called with null keys
9191
* @return this builder
9292
*/
93-
public EqualityTransformingBuilder<E> withEqualsHandlingNull(BiPredicate<? super E, ? super E> equals) {
93+
public EqualityTransformingCollectionBuilder<E> withEqualsHandlingNull(BiPredicate<? super E, ? super E> equals) {
9494
Objects.requireNonNull(equals, "The argument 'equals' must not be null.");
9595
this.equals = equals;
9696
return this;
@@ -101,7 +101,7 @@ public EqualityTransformingBuilder<E> withEqualsHandlingNull(BiPredicate<? super
101101
* a function determining equality of keys; will not be called with null keys
102102
* @return this builder
103103
*/
104-
public EqualityTransformingBuilder<E> withEquals(BiPredicate<? super E, ? super E> equals) {
104+
public EqualityTransformingCollectionBuilder<E> withEquals(BiPredicate<? super E, ? super E> equals) {
105105
Objects.requireNonNull(equals, "The argument 'equals' must not be null.");
106106
return withEqualsHandlingNull(makeNullSafe(equals));
107107
}
@@ -122,7 +122,7 @@ public EqualityTransformingBuilder<E> withEquals(BiPredicate<? super E, ? super
122122
* a function computing the hash code of a key; might be called with null keys
123123
* @return this builder
124124
*/
125-
public EqualityTransformingBuilder<E> withHashHandlingNull(ToIntFunction<? super E> hash) {
125+
public EqualityTransformingCollectionBuilder<E> withHashHandlingNull(ToIntFunction<? super E> hash) {
126126
Objects.requireNonNull(hash, "The argument 'hash' must not be null.");
127127
this.hash = hash;
128128
return this;
@@ -133,7 +133,7 @@ public EqualityTransformingBuilder<E> withHashHandlingNull(ToIntFunction<? super
133133
* a function computing the hash code of a key; will not be called with null keys
134134
* @return this builder
135135
*/
136-
public EqualityTransformingBuilder<E> withHash(ToIntFunction<? super E> hash) {
136+
public EqualityTransformingCollectionBuilder<E> withHash(ToIntFunction<? super E> hash) {
137137
Objects.requireNonNull(hash, "The argument 'hash' must not be null.");
138138
return withHashHandlingNull(makeNullSafe(hash));
139139
}

src/main/java/org/codefx/libfx/collection/transform/EqualityTransformingMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* <p>
1212
* It does so by storing the entries in an inner map and providing a transforming view on them. See the
1313
* {@link org.codefx.libfx.collection.transform package} documentation for general comments on that. Note that instances
14-
* of {@code EqualityTransformingMap}s are created with a {@link EqualityTransformingBuilder builder}.
14+
* of {@code EqualityTransformingMap}s are created with a {@link EqualityTransformingCollectionBuilder builder}.
1515
* <p>
1616
* This implementation mitigates the type safety problems by optionally using a token of the (outer) key type to check
1717
* instances against them. This solves some of the critical situations but not all of them. In those other cases

src/main/java/org/codefx/libfx/collection/transform/EqualityTransformingSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* <p>
1212
* It does so by storing the entries in an inner set and providing a transforming view on them. See the
1313
* {@link org.codefx.libfx.collection.transform package} documentation for general comments on that. Note that instances
14-
* of {@code EqualityTransformingSet}s are created with a {@link EqualityTransformingBuilder builder}.
14+
* of {@code EqualityTransformingSet}s are created with a {@link EqualityTransformingCollectionBuilder builder}.
1515
* <p>
1616
* This implementation mitigates the type safety problems by optionally using a token of the outer type to check
1717
* instances against them. This solves some of the critical situations but not all of them. In those other cases

src/test/java/org/codefx/libfx/collection/transform/EqualityTransformingMapTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static class LengthBasedEqualityAndHashCodeTests {
105105
@Before
106106
@SuppressWarnings("javadoc")
107107
public void createMap() {
108-
testedMap = EqualityTransformingBuilder
108+
testedMap = EqualityTransformingCollectionBuilder
109109
.forKeyType(String.class)
110110
.withEquals(equals)
111111
.withHash(hash)
@@ -168,7 +168,7 @@ public Iterable<Entry<String, Integer>> order(List<Entry<String, Integer>> inser
168168
@Override
169169
@SuppressWarnings("unchecked")
170170
public Map<String, Integer> create(Object... entries) {
171-
Map<String, Integer> transformingMap = EqualityTransformingBuilder
171+
Map<String, Integer> transformingMap = EqualityTransformingCollectionBuilder
172172
.forKeyType(String.class)
173173
.withEquals(equals)
174174
.withHash(hash)

src/test/java/org/codefx/libfx/collection/transform/EqualityTransformingSetTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static class LengthBasedEqualityAndHashCodeTests {
102102
@Before
103103
@SuppressWarnings("javadoc")
104104
public void createSet() {
105-
testedSet = EqualityTransformingBuilder
105+
testedSet = EqualityTransformingCollectionBuilder
106106
.forKeyType(String.class)
107107
.withEquals(equals)
108108
.withHash(hash)
@@ -131,7 +131,7 @@ public TransformingSetGenerator(BiPredicate<String, String> equals, ToIntFunctio
131131

132132
@Override
133133
public Set<String> create(Object... elements) {
134-
Set<String> transformingSet = EqualityTransformingBuilder
134+
Set<String> transformingSet = EqualityTransformingCollectionBuilder
135135
.forKeyType(String.class)
136136
.withEquals(equals)
137137
.withHash(hash)

0 commit comments

Comments
 (0)