From 7941b24080bd6ea8d24ecd0b49e2af79beb21f5b Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 7 Feb 2010 00:32:59 +0000 Subject: [PATCH] Cosmetics. --- .../cdt/core/parser/util/CollectionUtils.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CollectionUtils.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CollectionUtils.java index 7f4ad50c422..07dbb4fd4f0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CollectionUtils.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CollectionUtils.java @@ -14,7 +14,6 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; - /** * Useful utility methods for dealing with Collections. * @@ -25,8 +24,7 @@ public final class CollectionUtils { private CollectionUtils() { // this class has just static utility methods } - - + /** * Returns an iterator that iterates backwards over the given list. * The remove() method is not implemented and will throw UnsupportedOperationException. @@ -49,13 +47,12 @@ public final class CollectionUtils { } }; } - - + /** * Allows a foreach loop to iterate backwards over a list * from the end to the start. * - * eg) + * e.g. * for(Object o : reverseIterable(list)) { ... } * * @throws NullPointerException if list is null @@ -63,15 +60,14 @@ public final class CollectionUtils { public static Iterable reverseIterable(final List list) { return iterable(reverseIterator(list)); } - - + /** * Creates an Iterable instance that just returns * the given Iterator from its iterator() method. * * This is useful for using an iterator in a foreach loop directly. * - * eg) + * e.g. * * for(Object o : iterable(list.listIterator())) { * // do something @@ -80,7 +76,7 @@ public final class CollectionUtils { * @throws NullPointerException if list is null */ public static Iterable iterable(final Iterator iter) { - if(iter == null) + if (iter == null) throw new NullPointerException("iter parameter is null"); //$NON-NLS-1$ return new Iterable() { @@ -89,9 +85,7 @@ public final class CollectionUtils { } }; } - - - + /** * Finds the first object in the heterogeneous list that is an instance of * the given class, removes it from the list, and returns it. @@ -103,9 +97,9 @@ public final class CollectionUtils { */ @SuppressWarnings("unchecked") public static T findFirstAndRemove(List list, Class clazz) { - for(Iterator iter = list.iterator(); iter.hasNext();) { + for (Iterator iter = list.iterator(); iter.hasNext();) { Object o = iter.next(); - if(clazz.isInstance(o)) { + if (clazz.isInstance(o)) { iter.remove(); return (T) o; // safe }