Set<Integer> () { Set<Integer> nodes = new HashSet<>(); IntIterator it = myBlockBody.iterator(); while (it.hasNext()) { nodes.add(it.nextInt()); } it = myTails.iterator(); while (it.hasNext()) { nodes.add(it.nextInt()); } return nodes; }