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:
Trustin Lee 2014-06-21 16:57:06 +09:00
parent a49c4518c0
commit 365b3f5e11
2 changed files with 14 additions and 12 deletions

View File

@ -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_REMOTE;
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.IntObjectMap;
@ -519,7 +519,7 @@ public class DefaultHttp2Connection implements Http2Connection {
final IntObjectMap<DefaultStream> removeAllChildren() {
if (children.isEmpty()) {
return Collections.emptyIntObjectMap();
return PrimitiveCollections.emptyIntObjectMap();
}
totalChildWeights = 0;

View File

@ -14,16 +14,20 @@
*/
package io.netty.util.collection;
import io.netty.util.internal.EmptyArrays;
import java.util.Collections;
import java.util.Iterator;
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 Collections() {
private PrimitiveCollections() {
}
/**
@ -37,14 +41,12 @@ public final class Collections {
/**
* 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);
}
/**
* 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> {
@ -95,17 +97,17 @@ public final class Collections {
@Override
public Iterable<Entry<Object>> entries() {
return java.util.Collections.emptySet();
return Collections.emptySet();
}
@Override
public int[] keys() {
return new int[0];
return EmptyArrays.EMPTY_INTS;
}
@Override
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");
}
}
};
}
}