ColumnTypeDetector { public String getColumnType(String title, List<String> allTitles) { final String s = columns.get(title); if (title.equals("Kurs")) { List<String> allTypes = new ArrayList<>(); for (String t : allTitles) { if (!t.equals(title)) allTypes.add(getColumnType(t, allTitles)); } if (!allTypes.contains("class")) { return "class"; } } return s; } ColumnTypeDetector(); String getColumnType(String title, List<String> allTitles);  }
@Test public void testClass() { assertEquals("class", detector.getColumnType("Klasse", Collections.<String>emptyList())); assertEquals("class", detector.getColumnType("Klasse", Arrays.asList("Klasse", "Kurs", "Fach"))); assertEquals("ignore", detector.getColumnType("Kurs", Arrays.asList("Klasse", "Kurs", "Fach"))); assertEquals("class", detector.getColumnType("Kurs", Arrays.asList("Kurs", "Fach", "Raum"))); }