List of usage examples for java.util Enumeration hasMoreElements
boolean hasMoreElements();
From source file:Main.java
/** * Adds all elements in the enumeration to the given collection. * @deprecated Replaced by {@link Collection#addAll(java.util.Collection<? extends E>)} * * @param collection the collection to add to * @param enumeration the enumeration of elements to add, may not be null * @throws NullPointerException if the collection or enumeration is null *//*w w w . j a v a2 s . c om*/ public static <E> void addAll(Collection<E> collection, Enumeration<? extends E> enumeration) { while (enumeration.hasMoreElements()) { collection.add(enumeration.nextElement()); } }
From source file:Main.java
/** Returns an alphabetically sorted list of the keys. */ public static Vector getSortedKeyList(Hashtable hashtable) { Vector result = new Vector(); Enumeration keys = hashtable.keys(); while (keys.hasMoreElements()) { result.add(keys.nextElement());// w w w . jav a 2 s. com } Collections.sort(result, new Comparator() { public int compare(Object a, Object b) { String textA = a.toString(); String textB = b.toString(); return textA.compareToIgnoreCase(textB); } }); return result; }
From source file:MainClass.java
private static void printEnumeration(Enumeration e, String label) { System.out.println("-----" + label + "-----"); while (e.hasMoreElements()) { System.out.println(e.nextElement()); }/* www.j a v a2 s .com*/ }
From source file:Main.java
public static void loadExpansionState(JTree tree, Enumeration<TreePath> enumeration) { if (enumeration != null) { while (enumeration.hasMoreElements()) { TreePath treePath = enumeration.nextElement(); tree.expandPath(treePath);//from w w w . ja va 2 s. c o m } } }
From source file:Main.java
public static <T> List<T> asList(Enumeration<T> enumeration) { List<T> result = new ArrayList<T>(); while (enumeration.hasMoreElements()) result.add(enumeration.nextElement()); return result; }
From source file:net.jadler.stubbing.server.jetty.RequestUtils.java
private static Map<String, List<String>> converHeaders(HttpServletRequest request) { Map<String, List<String>> result = new HashMap<String, List<String>>(); Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = (String) headerNames.nextElement(); result.put(headerName, list(request.getHeaders(headerName))); }/* w ww . j a v a 2 s . c o m*/ return result; }
From source file:Main.java
public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) { ArrayList elements = new ArrayList(); while (enumeration.hasMoreElements()) { elements.add(enumeration.nextElement()); }//from w ww.j a v a2 s. c om return (A[]) elements.toArray(array); }
From source file:Main.java
public static void findClassesInApk(String apkPath, String packageName, List<String> classNames) throws IOException { DexFile dexFile = null;/*from w w w . ja v a2 s .c o m*/ try { dexFile = new DexFile(apkPath); Enumeration<String> apkClassNames = dexFile.entries(); while (apkClassNames.hasMoreElements()) { String className = apkClassNames.nextElement(); if (className.startsWith(packageName) && isToplevelClass(className)) { classNames.add(className); } } } catch (IOException e) { android.util.Log.w(LOGTAG, "Error finding classes at apk path: " + apkPath, e); } }
From source file:Main.java
public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) { ArrayList<A> elements = new ArrayList<A>(); while (enumeration.hasMoreElements()) elements.add(enumeration.nextElement()); return elements.toArray(array); }
From source file:Main.java
public static <T> List<T> list(Enumeration<? extends T> enumeration) { List<T> list = new ArrayList<T>(); while (enumeration.hasMoreElements()) { list.add(enumeration.nextElement()); }// w ww .j a v a 2s .c om return list; }