Ejemplo n.º 1
0
 public static Map filterLoadedValues(Map<String, String> in) {
   Map<String, Float> out = new HashMap<>();
   for (Iterator iterator = in.entrySet().iterator(); iterator.hasNext(); ) {
     Map.Entry entry = (Map.Entry) iterator.next();
     out.put(entry.getKey().toString(), Float.valueOf(entry.getValue().toString()));
   }
   return out;
 }
Ejemplo n.º 2
0
 public static void main(String args[]) {
   Map<String, String> in = new HashMap<>();
   in.put("val1", "10.0");
   in.put("val2", "60.0");
   Map<String, Float> mOriginal = filterLoadedValues(in);
   Map<String, Float> mLambda = filterLoadedValuesLambda(in);
   System.out.println("\nOriginal Entries\n--");
   mOriginal.entrySet().stream().forEach(TransformMap::printEntry);
   System.out.println("\nLambda Entries\n--");
   mLambda.entrySet().stream().forEach(TransformMap::printEntry);
 }
Ejemplo n.º 3
0
 public void add(Answer answer) {
   answers.put(answer.getQuestionText(), answer);
 }