1

Here is the code (class names are from Knime):

    HashMap<String,DataColumnSpec> rcols = new HashMap<String, DataColumnSpec>();
    rightSpec.forEach(rs -> { rcols.put(rs.getName(), rs); });
    DataColumnSpec[] jcols = leftSpec.stream()
        .filter(s -> rcols.containsKey(s.getName()))
        .toArray(DataColumnSpec[]::new);

The result is empty, but it should not be! There really is one matching column!

Here is the debugger screenshot:

enter image description here

Note P# in the first instance with id=14978 and the second id=666.

What is going on here? What do I do to fix it?

david.pfx
  • 10,520
  • 3
  • 30
  • 63

1 Answers1

3

The answer, sad to admit, was a non-printing character in one of the strings. The source of the data is the FileReader node on Knime, and it has a bug handling UTF-8-BOM data files. It injects a NUL character into the first string it reads, which is invisible in the debugger but throws off all the comparisons.

Full credit to @Ole V.V. It just didn't occur to me. Lesson learned!

david.pfx
  • 10,520
  • 3
  • 30
  • 63