mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplification: remove redundant types in intellij.platform.util module
This commit is contained in:
@@ -93,7 +93,7 @@ public class JDOMExternalizerUtil {
|
||||
}
|
||||
if (children.size() == 1) {
|
||||
String value = children.iterator().next().getAttributeValue(Constants.VALUE);
|
||||
return value == null ? Collections.<String>emptyList() : Collections.singletonList(value);
|
||||
return value == null ? Collections.emptyList() : Collections.singletonList(value);
|
||||
}
|
||||
List<String> values = ContainerUtil.newArrayListWithCapacity(children.size());
|
||||
for (Element child : children) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class JDOMUtil {
|
||||
|
||||
@NotNull
|
||||
public static List<Element> getChildren(@Nullable Element parent) {
|
||||
return parent == null ? Collections.<Element>emptyList() : parent.getChildren();
|
||||
return parent == null ? Collections.emptyList() : parent.getChildren();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -696,7 +696,7 @@ public class JDOMUtil {
|
||||
@NotNull
|
||||
public static List<Attribute> getAttributes(@NotNull Element e) {
|
||||
// avoid AttributeList creation if no attributes
|
||||
return e.hasAttributes() ? e.getAttributes() : Collections.<Attribute>emptyList();
|
||||
return e.hasAttributes() ? e.getAttributes() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1095,7 +1095,7 @@ public class FileUtil extends FileUtilRt {
|
||||
}
|
||||
|
||||
private static final JBTreeTraverser<File> FILE_TRAVERSER = JBTreeTraverser.from(
|
||||
(Function<File, Iterable<File>>)file -> file != null && file.isDirectory() ? JBIterable.of(file.listFiles()) : JBIterable.<File>empty());
|
||||
(Function<File, Iterable<File>>)file -> file != null && file.isDirectory() ? JBIterable.of(file.listFiles()) : JBIterable.empty());
|
||||
|
||||
public static boolean processFilesRecursively(@NotNull File root, @NotNull Processor<? super File> processor) {
|
||||
return fileTraverser(root).bfsTraversal().processEach(processor);
|
||||
|
||||
@@ -206,7 +206,7 @@ public final class ObjectTree<T> {
|
||||
@NotNull final ObjectTreeAction<? super T> action) {
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (recursiveGuard) {
|
||||
if (ArrayUtil.indexOf(recursiveGuard, object, ContainerUtil.<T>identityStrategy()) != -1) return;
|
||||
if (ArrayUtil.indexOf(recursiveGuard, object, ContainerUtil.identityStrategy()) != -1) return;
|
||||
recursiveGuard.add(object);
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public final class ObjectTree<T> {
|
||||
finally {
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (recursiveGuard) {
|
||||
int i = ArrayUtil.lastIndexOf(recursiveGuard, object, ContainerUtil.<T>identityStrategy());
|
||||
int i = ArrayUtil.lastIndexOf(recursiveGuard, object, ContainerUtil.identityStrategy());
|
||||
assert i != -1;
|
||||
recursiveGuard.remove(i);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class CommonProcessors {
|
||||
private final Processor<? super T> myDelegate;
|
||||
|
||||
public UniqueProcessor(@NotNull Processor<? super T> delegate) {
|
||||
this(delegate, ContainerUtil.<T>canonicalStrategy());
|
||||
this(delegate, ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
public UniqueProcessor(@NotNull Processor<? super T> delegate, @NotNull TObjectHashingStrategy<T> strategy) {
|
||||
|
||||
@@ -41,13 +41,13 @@ public class BidirectionalMultiMap<K, V> {
|
||||
@NotNull
|
||||
public Set<V> getValues(K key) {
|
||||
Set<V> set = myKey2Values.get(key);
|
||||
return set != null ? set : Collections.<V>emptySet();
|
||||
return set != null ? set : Collections.emptySet();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<K> getKeys(V value) {
|
||||
Set<K> set = myValue2Keys.get(value);
|
||||
return set != null ? set : Collections.<K>emptySet();
|
||||
return set != null ? set : Collections.emptySet();
|
||||
}
|
||||
|
||||
public boolean containsKey(K key) {
|
||||
|
||||
@@ -20,6 +20,6 @@ package com.intellij.util.containers;
|
||||
*/
|
||||
public class ConcurrentClassMap<T> extends ClassMap<T> {
|
||||
public ConcurrentClassMap() {
|
||||
super(ContainerUtil.<Class, T>newConcurrentMap());
|
||||
super(ContainerUtil.newConcurrentMap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
|
||||
|
||||
private static <T> T notNull(final Object key) {
|
||||
//noinspection unchecked
|
||||
return key == null ? ConcurrentFactoryMap.<T>FAKE_NULL() : (T)key;
|
||||
return key == null ? ConcurrentFactoryMap.FAKE_NULL() : (T)key;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,7 +153,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
|
||||
|
||||
@Override
|
||||
public V putIfAbsent(@NotNull K key, V value) {
|
||||
return nullize(myMap.putIfAbsent(ConcurrentFactoryMap.<K>notNull(key), ConcurrentFactoryMap.<V>notNull(value)));
|
||||
return nullize(myMap.putIfAbsent(ConcurrentFactoryMap.notNull(key), ConcurrentFactoryMap.notNull(value)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,12 +163,12 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
|
||||
|
||||
@Override
|
||||
public boolean replace(@NotNull K key, @NotNull V oldValue, @NotNull V newValue) {
|
||||
return myMap.replace(ConcurrentFactoryMap.<K>notNull(key), ConcurrentFactoryMap.<V>notNull(oldValue), ConcurrentFactoryMap.<V>notNull(newValue));
|
||||
return myMap.replace(ConcurrentFactoryMap.notNull(key), ConcurrentFactoryMap.notNull(oldValue), ConcurrentFactoryMap.notNull(newValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public V replace(@NotNull K key, @NotNull V value) {
|
||||
return nullize(myMap.replace(ConcurrentFactoryMap.<K>notNull(key), ConcurrentFactoryMap.<V>notNull(value)));
|
||||
return nullize(myMap.replace(ConcurrentFactoryMap.notNull(key), ConcurrentFactoryMap.notNull(value)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -291,7 +291,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
|
||||
|
||||
@Override
|
||||
public V setValue(V value) {
|
||||
return myEntry.setValue(ConcurrentFactoryMap.<V>notNull(value));
|
||||
return myEntry.setValue(ConcurrentFactoryMap.notNull(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -309,7 +309,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@Contract(pure=true)
|
||||
public static <T> Set<T> newHashOrEmptySet(@Nullable Iterable<? extends T> iterable) {
|
||||
boolean empty = iterable == null || iterable instanceof Collection && ((Collection)iterable).isEmpty();
|
||||
return empty ? Collections.<T>emptySet() : ContainerUtilRt.newHashSet(iterable);
|
||||
return empty ? Collections.emptySet() : ContainerUtilRt.newHashSet(iterable);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -369,24 +369,24 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <K> THashSet<K> newIdentityTroveSet() {
|
||||
return new THashSet<>(ContainerUtil.<K>identityStrategy());
|
||||
return new THashSet<>(ContainerUtil.identityStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <K> THashSet<K> newIdentityTroveSet(int initialCapacity) {
|
||||
return new THashSet<>(initialCapacity, ContainerUtil.<K>identityStrategy());
|
||||
return new THashSet<>(initialCapacity, ContainerUtil.identityStrategy());
|
||||
}
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <K> THashSet<K> newIdentityTroveSet(@NotNull Collection<? extends K> collection) {
|
||||
return new THashSet<>(collection, ContainerUtil.<K>identityStrategy());
|
||||
return new THashSet<>(collection, ContainerUtil.identityStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <K,V> THashMap<K,V> newIdentityTroveMap() {
|
||||
return new THashMap<>(ContainerUtil.<K>identityStrategy());
|
||||
return new THashMap<>(ContainerUtil.identityStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -410,7 +410,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Set<T> newConcurrentSet() {
|
||||
return Collections.newSetFromMap(ContainerUtil.<T, Boolean>newConcurrentMap());
|
||||
return Collections.newSetFromMap(ContainerUtil.newConcurrentMap());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1117,7 +1117,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Iterator<T> iterate(@NotNull T[] array) {
|
||||
return array.length == 0 ? EmptyIterator.<T>getInstance() : Arrays.asList(array).iterator();
|
||||
return array.length == 0 ? EmptyIterator.getInstance() : Arrays.asList(array).iterator();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1364,7 +1364,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
for (final Collection<? extends T> ts : list) {
|
||||
result.addAll(ts);
|
||||
}
|
||||
return result.isEmpty() ? Collections.<T>emptyList() : result;
|
||||
return result.isEmpty() ? Collections.emptyList() : result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1528,7 +1528,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
for (final V v : list) {
|
||||
result.addAll(listGenerator.fun(v));
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<T>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
@Contract(pure=true)
|
||||
@@ -1562,7 +1562,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<T>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1728,7 +1728,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
public static <T> Collection<T> subtract(@NotNull Collection<? extends T> from, @NotNull Collection<? extends T> what) {
|
||||
final Set<T> set = ContainerUtilRt.newHashSet(from);
|
||||
set.removeAll(what);
|
||||
return set.isEmpty() ? ContainerUtil.<T>emptyList() : set;
|
||||
return set.isEmpty() ? ContainerUtil.emptyList() : set;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1906,7 +1906,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
for (T t : iterable) {
|
||||
result.add(mapping.fun(t));
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<V>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1969,7 +1969,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
result.add(o);
|
||||
}
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<V>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1993,7 +1993,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
for (T element : elements) {
|
||||
addIfNotNull(list, element);
|
||||
}
|
||||
return list.isEmpty() ? ContainerUtil.<T>emptyList() : list;
|
||||
return list.isEmpty() ? ContainerUtil.emptyList() : list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2006,7 +2006,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
for (T t : array) {
|
||||
result.add(mapping.fun(t));
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<V>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -2069,13 +2069,13 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> List<T> createMaybeSingletonList(@Nullable T element) {
|
||||
return element == null ? ContainerUtil.<T>emptyList() : Collections.singletonList(element);
|
||||
return element == null ? ContainerUtil.emptyList() : Collections.singletonList(element);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Set<T> createMaybeSingletonSet(@Nullable T element) {
|
||||
return element == null ? Collections.<T>emptySet() : Collections.singleton(element);
|
||||
return element == null ? Collections.emptySet() : Collections.singleton(element);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -2327,7 +2327,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
result.addAll(list);
|
||||
}
|
||||
|
||||
return result.isEmpty() ? ContainerUtil.<E>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2346,7 +2346,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
result.add(e);
|
||||
}
|
||||
}
|
||||
return result.isEmpty() ? ContainerUtil.<E>emptyList() : result;
|
||||
return result.isEmpty() ? ContainerUtil.emptyList() : result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -2475,7 +2475,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@Contract(value = " -> new", pure = true)
|
||||
public static <T> CopyOnWriteArrayList<T> createEmptyCOWList() {
|
||||
// does not create garbage new Object[0]
|
||||
return new CopyOnWriteArrayList<>(ContainerUtilRt.<T>emptyList());
|
||||
return new CopyOnWriteArrayList<>(ContainerUtilRt.emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2564,13 +2564,13 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(value = " -> new", pure = true)
|
||||
public static <K,V> ConcurrentMap<K,V> createConcurrentWeakKeySoftValueMap() {
|
||||
return createConcurrentWeakKeySoftValueMap(100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.<K>canonicalStrategy());
|
||||
return createConcurrentWeakKeySoftValueMap(100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(value = " -> new", pure = true)
|
||||
public static <K,V> ConcurrentMap<K,V> createConcurrentWeakKeyWeakValueMap() {
|
||||
return createConcurrentWeakKeyWeakValueMap(ContainerUtil.<K>canonicalStrategy());
|
||||
return createConcurrentWeakKeyWeakValueMap(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -2704,7 +2704,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
set.add(value);
|
||||
}
|
||||
}
|
||||
return set.isEmpty() ? Collections.<V>emptySet() : set;
|
||||
return set.isEmpty() ? Collections.emptySet() : set;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2790,19 +2790,19 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> List<T> notNullize(@Nullable List<T> list) {
|
||||
return list == null ? ContainerUtilRt.<T>emptyList() : list;
|
||||
return list == null ? ContainerUtilRt.emptyList() : list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Set<T> notNullize(@Nullable Set<T> set) {
|
||||
return set == null ? Collections.<T>emptySet() : set;
|
||||
return set == null ? Collections.emptySet() : set;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
public static <K, V> Map<K, V> notNullize(@Nullable Map<K, V> map) {
|
||||
return map == null ? Collections.<K, V>emptyMap() : map;
|
||||
return map == null ? Collections.emptyMap() : map;
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
@@ -2910,7 +2910,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
public static <K,V> Map<K,V> createSoftValueMap() {
|
||||
//noinspection deprecation
|
||||
return new SoftValueHashMap<>(ContainerUtil.<K>canonicalStrategy());
|
||||
return new SoftValueHashMap<>(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2922,7 +2922,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@NotNull
|
||||
public static <K,V> Map<K,V> createWeakValueMap() {
|
||||
//noinspection deprecation
|
||||
return new WeakValueHashMap<>(ContainerUtil.<K>canonicalStrategy());
|
||||
return new WeakValueHashMap<>(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2958,7 +2958,7 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
@NotNull
|
||||
public static <K,V> Map<K,V> createWeakMap(int initialCapacity) {
|
||||
return createWeakMap(initialCapacity, 0.8f, ContainerUtil.<K>canonicalStrategy());
|
||||
return createWeakMap(initialCapacity, 0.8f, ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
@Contract(value = "_, _, _ -> new", pure = true)
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class FactoryMap<K,V> implements Map<K, V> {
|
||||
|
||||
private static <T> T notNull(final Object key) {
|
||||
//noinspection unchecked
|
||||
return key == null ? FactoryMap.<T>FAKE_NULL() : (T)key;
|
||||
return key == null ? FactoryMap.FAKE_NULL() : (T)key;
|
||||
}
|
||||
@Nullable
|
||||
private static <T> T nullize(T value) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class FilteredTraverserBase<T, Self extends FilteredTraverserBas
|
||||
|
||||
protected FilteredTraverserBase(@Nullable Meta<T> meta, @NotNull Function<? super T, ? extends Iterable<? extends T>> tree) {
|
||||
this.myTree = tree;
|
||||
this.myMeta = meta == null ? Meta.<T>empty() : meta;
|
||||
this.myMeta = meta == null ? Meta.empty() : meta;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -397,7 +397,7 @@ public abstract class FilteredTraverserBase<T, Self extends FilteredTraverserBas
|
||||
private static final Meta<?> EMPTY = new Meta<Object>(
|
||||
JBIterable.empty(), TreeTraversal.PRE_ORDER_DFS,
|
||||
Cond.TRUE, Cond.TRUE, Cond.TRUE,
|
||||
Cond.FALSE, Cond.FALSE, Functions.<TreeTraversal>id());
|
||||
Cond.FALSE, Cond.FALSE, Functions.id());
|
||||
|
||||
public static <T> Meta<T> empty() {
|
||||
return (Meta<T>)EMPTY;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class FilteringIterator<Dom, E extends Dom> implements PeekableIterator<E
|
||||
}
|
||||
|
||||
public static <T> Iterator<T> skipNulls(Iterator<T> iterator) {
|
||||
return create(iterator, Conditions.<T>notNull());
|
||||
return create(iterator, Conditions.notNull());
|
||||
}
|
||||
|
||||
public static <Dom, T extends Dom> Iterator<T> create(Iterator<Dom> iterator, Condition<? super Dom> condition) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
*/
|
||||
@NotNull
|
||||
public static <E> JBIterable<E> of(@Nullable E... elements) {
|
||||
return elements == null || elements.length == 0 ? JBIterable.<E>empty() : from(ContainerUtilRt.newArrayList(elements));
|
||||
return elements == null || elements.length == 0 ? JBIterable.empty() : from(ContainerUtilRt.newArrayList(elements));
|
||||
}
|
||||
|
||||
private static final JBIterable EMPTY = new Empty();
|
||||
@@ -627,7 +627,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
*/
|
||||
@NotNull
|
||||
public final <T> JBIterable<T> filterMap(@NotNull Function<? super E, T> function) {
|
||||
return map(function).filter(Conditions.<T>notNull());
|
||||
return map(function).filter(Conditions.notNull());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -668,7 +668,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
@NotNull
|
||||
public final JBIterable<List<E>> split(final int size, final boolean strict) {
|
||||
return split(size).filterMap(es -> {
|
||||
List<E> list = es.addAllTo(ContainerUtilRt.<E>newArrayListWithCapacity(size));
|
||||
List<E> list = es.addAllTo(ContainerUtilRt.newArrayListWithCapacity(size));
|
||||
return strict && list.size() < size ? null : list;
|
||||
});
|
||||
}
|
||||
@@ -795,7 +795,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
@NotNull
|
||||
public final JBIterable<E> collect() {
|
||||
if (content instanceof Collection) return this;
|
||||
return collect(ContainerUtilRt.<E>newArrayList());
|
||||
return collect(ContainerUtilRt.newArrayList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -804,7 +804,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
*/
|
||||
@NotNull
|
||||
public final JBIterable<E> sort(@NotNull Comparator<? super E> comparator) {
|
||||
ArrayList<E> list = addAllTo(ContainerUtilRt.<E>newArrayList());
|
||||
ArrayList<E> list = addAllTo(ContainerUtilRt.newArrayList());
|
||||
list.sort(comparator);
|
||||
return from(list);
|
||||
}
|
||||
@@ -857,7 +857,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
public final <K, V> Map<K, V> toMap(@NotNull Convertor<E, K> toKey, @NotNull Convertor<E, V> toValue) {
|
||||
Map<K, V> map = ContainerUtil.newLinkedHashMap();
|
||||
for (E e : this) map.put(toKey.convert(e), toValue.convert(e));
|
||||
return map.isEmpty() ? Collections.<K, V>emptyMap() : Collections.unmodifiableMap(map);
|
||||
return map.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class JBIterator<E> implements Iterator<E> {
|
||||
|
||||
@NotNull
|
||||
public static <E extends JBIterator<?>> JBIterable<E> cursor(@NotNull E iterator) {
|
||||
return JBIterable.generate(iterator, Functions.<E>id()).intercept(CURSOR_NEXT);
|
||||
return JBIterable.generate(iterator, Functions.id()).intercept(CURSOR_NEXT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -28,7 +28,7 @@ public class JBTreeTraverser<T> extends FilteredTraverserBase<T, JBTreeTraverser
|
||||
|
||||
@NotNull
|
||||
public static <T> JBTreeTraverser<T> of(@NotNull Function<? super T, T[]> treeStructure) {
|
||||
return new JBTreeTraverser<>(Functions.compose(treeStructure, Functions.<T>wrapArray()));
|
||||
return new JBTreeTraverser<>(Functions.compose(treeStructure, Functions.wrapArray()));
|
||||
}
|
||||
|
||||
public JBTreeTraverser(Function<? super T, ? extends Iterable<? extends T>> treeStructure) {
|
||||
|
||||
@@ -881,7 +881,7 @@ class LockFreeCopyOnWriteArrayList<E> implements List<E>, RandomAccess, Concurre
|
||||
throw new IndexOutOfBoundsException("Index: " + index);
|
||||
}
|
||||
|
||||
return elements.length == 0 ? EmptyListIterator.<E>getInstance() : new COWIterator(elements, index);
|
||||
return elements.length == 0 ? EmptyListIterator.getInstance() : new COWIterator(elements, index);
|
||||
}
|
||||
|
||||
private class COWIterator implements ListIterator<E> {
|
||||
|
||||
@@ -338,7 +338,7 @@ public class MultiMap<K, V> implements Serializable {
|
||||
|
||||
@NotNull
|
||||
public static <K, V> MultiMap<K, V> createSet() {
|
||||
return createSet(ContainerUtil.<K>canonicalStrategy());
|
||||
return createSet(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -26,7 +26,7 @@ public class OrderedSet<T> extends ArrayList<T> implements Set<T>, RandomAccess
|
||||
private final OpenTHashSet<T> myHashSet;
|
||||
|
||||
public OrderedSet() {
|
||||
this(ContainerUtil.<T>canonicalStrategy());
|
||||
this(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
public OrderedSet(@NotNull Collection<? extends T> set) {
|
||||
@@ -45,7 +45,7 @@ public class OrderedSet<T> extends ArrayList<T> implements Set<T>, RandomAccess
|
||||
}
|
||||
|
||||
public OrderedSet(int capacity) {
|
||||
this(ContainerUtil.<T>canonicalStrategy(), capacity);
|
||||
this(ContainerUtil.canonicalStrategy(), capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ abstract class RefHashMap<K, V> extends AbstractMap<K, V> implements Map<K, V> {
|
||||
}
|
||||
|
||||
RefHashMap(int initialCapacity, float loadFactor) {
|
||||
this(initialCapacity, loadFactor, ContainerUtil.<K>canonicalStrategy());
|
||||
this(initialCapacity, loadFactor, ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
RefHashMap(int initialCapacity) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SoftArrayHashMap<T,V> implements Cloneable {
|
||||
private final TObjectHashingStrategy<T> myStrategy;
|
||||
|
||||
public SoftArrayHashMap() {
|
||||
this(ContainerUtil.<T>canonicalStrategy());
|
||||
this(ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
public SoftArrayHashMap(@NotNull TObjectHashingStrategy<T> strategy) {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class TransferToEDTQueue<T> {
|
||||
}
|
||||
|
||||
public boolean offerIfAbsent(@NotNull T thing) {
|
||||
return offerIfAbsent(thing, ContainerUtil.<T>canonicalStrategy());
|
||||
return offerIfAbsent(thing, ContainerUtil.canonicalStrategy());
|
||||
}
|
||||
|
||||
public boolean offerIfAbsent(@NotNull final T thing, @NotNull final Equality<? super T> equality) {
|
||||
|
||||
@@ -394,7 +394,7 @@ public abstract class TreeTraversal {
|
||||
@NotNull
|
||||
public JBIterable<T> backtrace() {
|
||||
if (cur == null) throw new NoSuchElementException();
|
||||
return _transform(JBIterable.generate(cur, P.<T>toPrev()).filterMap(P.<T>toNode()));
|
||||
return _transform(JBIterable.generate(cur, P.toPrev()).filterMap(P.toNode()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ public abstract class TreeTraversal {
|
||||
private final static class TracingBfsIt<T> extends TracingIt<T> {
|
||||
|
||||
final ArrayDeque<T> queue = new ArrayDeque<>();
|
||||
final Map<T, T> paths = ContainerUtil.newTroveMap(ContainerUtil.<T>identityStrategy());
|
||||
final Map<T, T> paths = ContainerUtil.newTroveMap(ContainerUtil.identityStrategy());
|
||||
P1<T> top;
|
||||
P1<T> cur;
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ public class UnsafeWeakList<T> extends AbstractCollection<T> {
|
||||
}
|
||||
@NotNull
|
||||
public List<T> toStrongList() {
|
||||
return ContainerUtil.mapNotNull(myList, UnsafeWeakList.<T>deref());
|
||||
return ContainerUtil.mapNotNull(myList, UnsafeWeakList.deref());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Diff {
|
||||
if (changeRef != null) return changeRef.get();
|
||||
|
||||
int trimmedLength = objects1.length + objects2.length - 2 * startShift - 2 * endCut;
|
||||
Enumerator<T> enumerator = new Enumerator<>(trimmedLength, ContainerUtil.<T>canonicalStrategy());
|
||||
Enumerator<T> enumerator = new Enumerator<>(trimmedLength, ContainerUtil.canonicalStrategy());
|
||||
int[] ints1 = enumerator.enumerate(objects1, startShift, endCut);
|
||||
int[] ints2 = enumerator.enumerate(objects2, startShift, endCut);
|
||||
return doBuildChanges(ints1, ints2, new ChangeBuilder(startShift));
|
||||
|
||||
@@ -277,7 +277,7 @@ public class DiffTree<OT, NT> {
|
||||
CompareResult c11 = looksEqual(oldChild, newChild);
|
||||
|
||||
if (c11 == CompareResult.DRILL_DOWN_NEEDED) {
|
||||
c11 = textMatch(oldChild, newChild) ? build(oldChild, newChild, level + 1, DiffTree.<OT, NT>emptyConsumer()) : CompareResult.NOT_EQUAL;
|
||||
c11 = textMatch(oldChild, newChild) ? build(oldChild, newChild, level + 1, DiffTree.emptyConsumer()) : CompareResult.NOT_EQUAL;
|
||||
assert c11 != CompareResult.DRILL_DOWN_NEEDED;
|
||||
}
|
||||
if (c11 != CompareResult.EQUAL) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class CachingSemiGraph<Node> implements GraphGenerator.SemiGraph<Node> {
|
||||
final List<Node> inNodes = myIn.get(n);
|
||||
return inNodes != null
|
||||
? inNodes.iterator()
|
||||
: ContainerUtil.<Node>emptyIterator();
|
||||
: ContainerUtil.emptyIterator();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class GraphGenerator<Node> implements Graph<Node> {
|
||||
final List<Node> outNodes = myOuts.get(n);
|
||||
return outNodes != null
|
||||
? outNodes.iterator()
|
||||
: ContainerUtil.<Node>emptyIterator();
|
||||
: ContainerUtil.emptyIterator();
|
||||
}
|
||||
|
||||
//<editor-fold desc="Deprecated stuff.">
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class CollectionInputDataDiffBuilder<Key, Value> extends InputDataDiffBui
|
||||
|
||||
public CollectionInputDataDiffBuilder(int inputId, @Nullable Collection<Key> seq) {
|
||||
super(inputId);
|
||||
mySeq = seq == null ? Collections.<Key>emptySet() : seq;
|
||||
mySeq = seq == null ? Collections.emptySet() : seq;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MapInputDataDiffBuilder<Key, Value> extends InputDataDiffBuilder<Ke
|
||||
|
||||
public MapInputDataDiffBuilder(int inputId, @Nullable Map<Key, Value> map) {
|
||||
super(inputId);
|
||||
myMap = map == null ? Collections.<Key, Value>emptyMap() : map;
|
||||
myMap = map == null ? Collections.emptyMap() : map;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.util.io.zip;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import java.util.HashMap;
|
||||
import com.intellij.util.lang.JarMemoryLoader;
|
||||
|
||||
import java.io.File;
|
||||
@@ -40,7 +39,7 @@ public class ReorderJarsMain {
|
||||
final String libPath = args.length > 3 ? args[3] : null;
|
||||
|
||||
final Map<String, List<String>> toReorder = getOrder(new File(orderTxtPath));
|
||||
final Set<String> ignoredJars = libPath == null ? Collections.<String>emptySet() : loadIgnoredJars(libPath);
|
||||
final Set<String> ignoredJars = libPath == null ? Collections.emptySet() : loadIgnoredJars(libPath);
|
||||
|
||||
for (String jarUrl : toReorder.keySet()) {
|
||||
if (ignoredJars.contains(StringUtil.trimStart(jarUrl, "/lib/"))) continue;
|
||||
|
||||
@@ -49,17 +49,17 @@ public class CompoundRuntimeException extends RuntimeException {
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return processAll(Throwable::getMessage, EmptyConsumer.<String>getInstance());
|
||||
return processAll(Throwable::getMessage, EmptyConsumer.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedMessage() {
|
||||
return processAll(Throwable::getLocalizedMessage, EmptyConsumer.<String>getInstance());
|
||||
return processAll(Throwable::getLocalizedMessage, EmptyConsumer.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return processAll(Throwable::toString, EmptyConsumer.<String>getInstance());
|
||||
return processAll(Throwable::toString, EmptyConsumer.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -400,7 +400,7 @@ public class MessageBusImpl implements MessageBus {
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
return exceptions == null ? Collections.<Throwable>emptyList() : exceptions;
|
||||
return exceptions == null ? Collections.emptyList() : exceptions;
|
||||
}
|
||||
|
||||
void notifyOnSubscription(@NotNull MessageBusConnectionImpl connection, @NotNull Topic<?> topic) {
|
||||
|
||||
@@ -33,6 +33,6 @@ public class FilePathHashingStrategy {
|
||||
|
||||
@NotNull
|
||||
public static TObjectHashingStrategy<String> create(boolean caseSensitive) {
|
||||
return caseSensitive ? ContainerUtil.<String>canonicalStrategy() : CaseInsensitiveStringHashingStrategy.INSTANCE;
|
||||
return caseSensitive ? ContainerUtil.canonicalStrategy() : CaseInsensitiveStringHashingStrategy.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public final class FontInfo {
|
||||
*/
|
||||
public static List<FontInfo> getAll(boolean withAllStyles) {
|
||||
return GraphicsEnvironment.isHeadless()
|
||||
? Collections.<FontInfo>emptyList()
|
||||
? Collections.emptyList()
|
||||
: withAllStyles
|
||||
? LazyListByFont.LIST
|
||||
: LazyListByName.LIST;
|
||||
|
||||
@@ -908,7 +908,7 @@ public class UIUtil {
|
||||
|
||||
public static void setEnabled(@NotNull Component component, boolean enabled, boolean recursively, final boolean visibleOnly) {
|
||||
JBIterable<Component> all = recursively ? uiTraverser(component).expandAndFilter(
|
||||
visibleOnly ? (Condition<Component>)Component::isVisible : Conditions.<Component>alwaysTrue()).traverse() : JBIterable.of(component);
|
||||
visibleOnly ? (Condition<Component>)Component::isVisible : Conditions.alwaysTrue()).traverse() : JBIterable.of(component);
|
||||
Color fg = enabled ? getLabelForeground() : getLabelDisabledForeground();
|
||||
for (Component c : all) {
|
||||
c.setEnabled(enabled);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
|
||||
private static final boolean mySkinny = false;
|
||||
|
||||
public WideSelectionTreeUI() {
|
||||
this(true, Conditions.<Integer>alwaysTrue());
|
||||
this(true, Conditions.alwaysTrue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,7 +74,7 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
|
||||
Binding binding = serializer.getBinding(itemType);
|
||||
Class<?>[] elementTypes = getElementTypes();
|
||||
if (elementTypes.length == 0) {
|
||||
itemBindings = binding == null ? Collections.<Binding>emptyList() : Collections.singletonList(binding);
|
||||
itemBindings = binding == null ? Collections.emptyList() : Collections.singletonList(binding);
|
||||
}
|
||||
else {
|
||||
itemBindings = new SmartList<>();
|
||||
|
||||
@@ -220,7 +220,7 @@ public class JDOMXIncluder {
|
||||
}
|
||||
else {
|
||||
Element resolvedElement = resolveNonXIncludeElement(original, bases);
|
||||
return Collections.<Content>singletonList(resolvedElement);
|
||||
return Collections.singletonList(resolvedElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ class MapBinding extends Binding implements MultiNodeBinding {
|
||||
}
|
||||
else {
|
||||
Element entryChild = entry.getChild(attributeName);
|
||||
List<Element> children = entryChild == null ? Collections.<Element>emptyList() : entryChild.getChildren();
|
||||
List<Element> children = entryChild == null ? Collections.emptyList() : entryChild.getChildren();
|
||||
if (children.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user