List of usage examples for java.util Iterator hasNext
boolean hasNext();
From source file:Main.java
public static Map<String, String> parseStringJsonMap(JSONObject object) throws JSONException { Map<String, String> map = new ArrayMap<String, String>(); Iterator<String> keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, object.getString(key)); }// w w w . j av a2s . c o m return map; }
From source file:Main.java
private static String reconstruireDonnee(Vector<Integer> vectBit) { String donnee = ""; //On ajoute le nouvel encodage dans le String "ligne" vide ci-haut Iterator<Integer> it = vectBit.iterator(); while (it.hasNext()) { donnee += it.next();/*from ww w. java 2s.com*/ } return donnee; }
From source file:Main.java
/** * Parse Set to ArrayList/*from w w w . j a v a 2 s . c o m*/ * * @param set * @return ArrayList */ public static <T> ArrayList<T> setToArrayList(Set<T> set) { if (set == null) return null; ArrayList<T> tArray = new ArrayList<T>(); Iterator<T> it = set.iterator(); while (it.hasNext()) { T t = it.next(); tArray.add(t); } return tArray; }
From source file:Main.java
public static void putAllInHashMapByGivenAttribute(HashMap map, Collection col, String attribName) { Iterator iter = col.iterator(); while (iter.hasNext()) putInHashMapByGivenAttribute(map, iter.next(), attribName); }
From source file:Main.java
public static Map<String, Integer> parseIntegerJsonMap(JSONObject object) throws JSONException { Map<String, Integer> map = new ArrayMap<String, Integer>(); Iterator<String> keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, object.getInt(key)); }//from ww w.java 2 s . c o m return map; }
From source file:Main.java
public static Map<String, Long> parseLongJsonMap(JSONObject object) throws JSONException { Map<String, Long> map = new ArrayMap<String, Long>(); Iterator<String> keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, object.getLong(key)); }//from w ww . ja va2s .c om return map; }
From source file:Main.java
public static HashSet<String> intersectionSet(HashSet<String> setA, HashSet<String> setB) { HashSet<String> intersectionSet = new HashSet<String>(); Iterator<String> iterA = setA.iterator(); while (iterA.hasNext()) { String tempInner = iterA.next(); if (setB.contains(tempInner)) { intersectionSet.add(tempInner); }/*from w w w . j a v a 2 s .co m*/ } return intersectionSet; }
From source file:Main.java
/** * Answer a set containing all elements that are both in source and in query * Delete these elements from source Creation date: (13.10.2002 16:23:00) * //from w ww .j a v a 2 s.co m * @return java.util.Set * @param source * java.util.Set * @param elements * java.util.Collection */ public static Set extractFrom(Set source, Collection query) { Set answer = new HashSet(); Iterator i = query.iterator(); while (i.hasNext()) { Object o = i.next(); if (source.remove(o)) { answer.add(o); } } return answer; }
From source file:Main.java
public static Map<String, Double> parseDoubleJsonMap(JSONObject object) throws JSONException { Map<String, Double> map = new ArrayMap<String, Double>(); Iterator<String> keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, object.getDouble(key)); }/*from w w w . j a v a2s . c o m*/ return map; }
From source file:Main.java
public static String toString(Collection<?> list, String split) { if (list == null) { return null; }//w ww . j ava 2 s . co m StringBuffer rs = new StringBuffer(); Iterator<?> it = list.iterator(); while (it.hasNext()) { rs.append(it.next()); if (it.hasNext()) { rs.append(split); } } return rs.toString(); }