0

I'm reading a file, and extract from if some fields that I suppose to store in a tuple. (vavr tuples)

The hashmap does not store any elements. I think I have a problem with initialization that I don't seem to figure out Hashmap is of Java.util and the tuple from vavr

Tuple3<HashMap<String, Integer>, HashMap<String, Integer>, List<Tuple2<String, String>>> tupleResourceActivity = traceRecursion
                .apply(f, Tuple.of( new HashMap<String, Integer>(),new HashMap<String, Integer>(),new LinkedList<Tuple2<String, String>>()));

The trace recursion function :

traceRecursion = (x, t) -> {
        if (x.hasNext()) {
            Tuple3<HashMap<String, Integer>, HashMap<String, Integer>, List<Tuple2<String, String>>> tx = evtRecursion
                    .apply(x.next().iterator(), t);
            return traceRecursion.apply(x, tx);
        } else {
            return t;
        }

    };  

What is it that I'm doing wrong?

Sachith Wickramaarachchi
  • 5,546
  • 6
  • 39
  • 68
Her sincerly
  • 373
  • 1
  • 13
  • Its hard to read the definition of `tupleResourceActivity`. Why you dont use a custom-class for it? And how do you read your file? – akop Apr 18 '19 at 10:12
  • I'm readiing the file using a log.iterator(). Do you mean by a custom class, creating a triplet class and a pair class ? – Her sincerly Apr 18 '19 at 10:14
  • Yeah, some in this way. You can give the fields names so you can see very nice what that fields stores. – akop Apr 18 '19 at 10:20
  • I wanted to exploit the tuples existing definition thats why I didnt – Her sincerly Apr 18 '19 at 10:29
  • 1
    And what are you reach which this "exploit"? Nothing but a hard readble code, that nobody wants to maintain. Easy code is much better than "hacks" - in a couple of months you dont know what your code is doing. – akop Apr 18 '19 at 10:46
  • Okay ,I'll see what I can do about – Her sincerly Apr 18 '19 at 11:04

0 Answers0