Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-11-19 03:22:45 -0500
committerGerrit Code Review @ Eclipse.org2013-11-19 04:08:59 -0500
commit1eece4f1366d56ff50e5b41df6c2845fef0214ad (patch)
tree99856307405eefe819f385375658141a2e6a17ca /bundles/org.eclipse.equinox.p2.core
parente193ccd994def3fd574aee5335e8cf8a1c610ae4 (diff)
downloadrt.equinox.p2-1eece4f1366d56ff50e5b41df6c2845fef0214ad.tar.gz
rt.equinox.p2-1eece4f1366d56ff50e5b41df6c2845fef0214ad.tar.xz
rt.equinox.p2-1eece4f1366d56ff50e5b41df6c2845fef0214ad.zip
Bug 422026 - Get rid of ColletionUtils.empty[Set|List|Map]
Now that p2 has Java 1.5 as a minimum there is no reason to not use the JVM methods. Change-Id: I89444e8d1e174c316e2b17fb4f53bc7b1d097c0a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.core')
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java6
2 files changed, 5 insertions, 39 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
index 5bea8c961..edbf40ab5 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
@@ -166,47 +166,13 @@ public class CollectionUtils {
}
/**
- * The emptyList() method was introduced in Java 1.5 so we need this here to be able to
- * down compile to 1.4.
- * @param <T> The type of the elements
- * @return An empty list
- */
- @SuppressWarnings("unchecked")
- public static <T> List<T> emptyList() {
- return Collections.EMPTY_LIST;
- }
-
- /**
- * The emptySet() method was introduced in Java 1.5 so we need this here to be able to
- * down compile to 1.4.
- * @param <T> The type of the elements
- * @return An empty set
- */
- @SuppressWarnings("unchecked")
- public static <T> Set<T> emptySet() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * The emptyMap() method was introduced in Java 1.5 so we need this here to be able to
- * down compile to 1.4.
- * @param <K> The type of the map keys
- * @param <V> The type of the map values
- * @return An empty set
- */
- @SuppressWarnings("unchecked")
- public static <K, V> Map<K, V> emptyMap() {
- return Collections.EMPTY_MAP;
- }
-
- /**
* Returns an unmodifiable list that is backed by the <code>array</code>.
* @param <T> The list element type
* @param array The array of elements
* @return The unmodifiable list
*/
public static <T> List<T> unmodifiableList(T[] array) {
- return array == null || array.length == 0 ? CollectionUtils.<T> emptyList() : new UnmodifiableArrayList<T>(array);
+ return array == null || array.length == 0 ? Collections.<T> emptyList() : new UnmodifiableArrayList<T>(array);
}
/**
@@ -229,7 +195,7 @@ public class CollectionUtils {
*/
public static Map<String, String> toMap(Properties properties) {
if (properties == null || properties.isEmpty())
- return emptyMap();
+ return Collections.<String, String> emptyMap();
Map<String, String> props = new HashMap<String, String>(properties.size());
putAll(properties, props);
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
index cf20a741e..45676cb57 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java
@@ -109,7 +109,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map
}
public Set<Map.Entry<String, String>> entrySet() {
- return propertyMap != null ? propertyMap.entrySet() : CollectionUtils.<Map.Entry<String, String>> emptySet();
+ return propertyMap != null ? propertyMap.entrySet() : Collections.<Map.Entry<String, String>> emptySet();
}
public String get(Object key) {
@@ -117,7 +117,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map
}
public Set<String> keySet() {
- return propertyMap != null ? propertyMap.keySet() : CollectionUtils.<String> emptySet();
+ return propertyMap != null ? propertyMap.keySet() : Collections.<String> emptySet();
}
public void putAll(Map<? extends String, ? extends String> arg0) {
@@ -130,7 +130,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map
}
public Collection<String> values() {
- return propertyMap != null ? propertyMap.values() : CollectionUtils.<String> emptyList();
+ return propertyMap != null ? propertyMap.values() : Collections.<String> emptyList();
}
public boolean equals(Object o) {

Back to the top