private Iterator<Outcome> mapKeyValuesToOutcomes(Iterator<KeyValue> iterator) {
    final Outcome outcome = new Outcome(null, 0.0);
    final VariableNumMap vars = getVars();

    return Iterators.transform(iterator, new Function<KeyValue, Outcome>() {
      @Override
      public Outcome apply(KeyValue keyValue) {
        outcome.setAssignment(vars.intArrayToAssignment(keyValue.getKey()));
        outcome.setProbability(keyValue.getValue());
        return outcome;
      }
    });
  }
private Iterator < Outcome > mapKeyValuesToOutcomes ( Iterator < KeyValue > iterator ) { final Outcome outcome = new Outcome ( null , 0.0 ) ; final VariableNumMap vars = getVars ( ) ; return Iterators . transform ( iterator , new Function < KeyValue , Outcome > ( ) { @ Override public Outcome apply ( KeyValue keyValue ) { outcome . setAssignment ( vars . intArrayToAssignment ( keyValue . getKey ( ) ) ) ; outcome . setProbability ( keyValue . getValue ( ) ) ; return outcome ; } } ) ; }
Maps an iterator over a tensor's {@code KeyValue}s into {@code Outcome}s.