geforkt von Mirrors/Velocity
CappedSet.newCappedSet() -> CappedSet.create()
Dieser Commit ist enthalten in:
Ursprung
57085feb42
Commit
5bd9f0a96f
@ -108,7 +108,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
this.virtualHost = virtualHost;
|
||||
this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED;
|
||||
this.connectionPhase = minecraftConnection.getType().getInitialClientPhase();
|
||||
this.knownChannels = CappedSet.newCappedSet(MAX_PLUGIN_CHANNELS);
|
||||
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class CappedSet<T> extends ForwardingSet<T> {
|
||||
* @param <T> the type of elements in the collection
|
||||
* @return the new collection
|
||||
*/
|
||||
public static <T> Set<T> newCappedSet(int maxSize) {
|
||||
public static <T> Set<T> create(int maxSize) {
|
||||
return new CappedSet<>(new HashSet<>(), maxSize);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ class CappedSetTest {
|
||||
|
||||
@Test
|
||||
void basicVerification() {
|
||||
Collection<String> coll = CappedSet.newCappedSet(1);
|
||||
Collection<String> coll = CappedSet.create(1);
|
||||
assertTrue(coll.add("coffee"), "did not add single item");
|
||||
assertThrows(IllegalStateException.class, () -> coll.add("tea"),
|
||||
"item was added to collection although it is too full");
|
||||
@ -27,7 +27,7 @@ class CappedSetTest {
|
||||
Set<String> doesFill2 = ImmutableSet.of("chocolate");
|
||||
Set<String> overfill = ImmutableSet.of("Coke", "Pepsi");
|
||||
|
||||
Collection<String> coll = CappedSet.newCappedSet(3);
|
||||
Collection<String> coll = CappedSet.create(3);
|
||||
assertTrue(coll.addAll(doesFill1), "did not add items");
|
||||
assertTrue(coll.addAll(doesFill2), "did not add items");
|
||||
assertThrows(IllegalStateException.class, () -> coll.addAll(overfill),
|
||||
@ -41,7 +41,7 @@ class CappedSetTest {
|
||||
Set<String> doesFill2 = ImmutableSet.of("coffee", "chocolate");
|
||||
Set<String> overfill = ImmutableSet.of("coffee", "Coke", "Pepsi");
|
||||
|
||||
Collection<String> coll = CappedSet.newCappedSet(3);
|
||||
Collection<String> coll = CappedSet.create(3);
|
||||
assertTrue(coll.addAll(doesFill1), "did not add items");
|
||||
assertTrue(coll.addAll(doesFill2), "did not add items");
|
||||
assertThrows(IllegalStateException.class, () -> coll.addAll(overfill),
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren