Rename io.netty.util.collection.Collections to PrimitiveCollections
Motivation: An IDE's auto-completion often confuses between java.util.Collections and io.netty.util.collection.Collections, and it's annoying to me. :-) Modifications: Use a different class name. Result: When I type Collections, it's always 'the' Collections.
This commit is contained in:
parent
a49c4518c0
commit
365b3f5e11
@ -30,7 +30,7 @@ import static io.netty.handler.codec.http2.Http2Stream.State.OPEN;
|
|||||||
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_LOCAL;
|
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_LOCAL;
|
||||||
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_REMOTE;
|
import static io.netty.handler.codec.http2.Http2Stream.State.RESERVED_REMOTE;
|
||||||
import io.netty.handler.codec.http2.Http2StreamRemovalPolicy.Action;
|
import io.netty.handler.codec.http2.Http2StreamRemovalPolicy.Action;
|
||||||
import io.netty.util.collection.Collections;
|
import io.netty.util.collection.PrimitiveCollections;
|
||||||
import io.netty.util.collection.IntObjectHashMap;
|
import io.netty.util.collection.IntObjectHashMap;
|
||||||
import io.netty.util.collection.IntObjectMap;
|
import io.netty.util.collection.IntObjectMap;
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ public class DefaultHttp2Connection implements Http2Connection {
|
|||||||
|
|
||||||
final IntObjectMap<DefaultStream> removeAllChildren() {
|
final IntObjectMap<DefaultStream> removeAllChildren() {
|
||||||
if (children.isEmpty()) {
|
if (children.isEmpty()) {
|
||||||
return Collections.emptyIntObjectMap();
|
return PrimitiveCollections.emptyIntObjectMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
totalChildWeights = 0;
|
totalChildWeights = 0;
|
||||||
|
@ -14,16 +14,20 @@
|
|||||||
*/
|
*/
|
||||||
package io.netty.util.collection;
|
package io.netty.util.collection;
|
||||||
|
|
||||||
|
import io.netty.util.internal.EmptyArrays;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for collections.
|
* Utility methods for primitive collections.
|
||||||
*/
|
*/
|
||||||
public final class Collections {
|
public final class PrimitiveCollections {
|
||||||
|
|
||||||
private static final IntObjectMap<Object> EMPTY_INT_OBJECT_MAP = new EmptyIntObjectMap();
|
private static final IntObjectMap<Object> EMPTY_INT_OBJECT_MAP = new EmptyIntObjectMap();
|
||||||
|
|
||||||
private Collections() {
|
private PrimitiveCollections() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,14 +41,12 @@ public final class Collections {
|
|||||||
/**
|
/**
|
||||||
* Creates an unmodifiable wrapper around the given map.
|
* Creates an unmodifiable wrapper around the given map.
|
||||||
*/
|
*/
|
||||||
public static <V> IntObjectMap<V> unmodifiable(final IntObjectMap<V> map) {
|
public static <V> IntObjectMap<V> unmodifiableIntObjectMap(final IntObjectMap<V> map) {
|
||||||
return new UnmodifiableIntObjectMap<V>(map);
|
return new UnmodifiableIntObjectMap<V>(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An empty map. All operations that attempt to modify the map are unsupported.
|
* An empty map. All operations that attempt to modify the map are unsupported.
|
||||||
*
|
|
||||||
* @param <V> the value type for the map.
|
|
||||||
*/
|
*/
|
||||||
private static final class EmptyIntObjectMap implements IntObjectMap<Object> {
|
private static final class EmptyIntObjectMap implements IntObjectMap<Object> {
|
||||||
|
|
||||||
@ -95,17 +97,17 @@ public final class Collections {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Entry<Object>> entries() {
|
public Iterable<Entry<Object>> entries() {
|
||||||
return java.util.Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] keys() {
|
public int[] keys() {
|
||||||
return new int[0];
|
return EmptyArrays.EMPTY_INTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] values(Class<Object> clazz) {
|
public Object[] values(Class<Object> clazz) {
|
||||||
return new Object[0];
|
return EmptyArrays.EMPTY_OBJECTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,5 +243,5 @@ public final class Collections {
|
|||||||
throw new UnsupportedOperationException("setValue");
|
throw new UnsupportedOperationException("setValue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user