You can pre-populate Map<Integer, String> and save it somewhere, and then use this to determine your value without conditional checking. How,
Map<Integer, String> valueMap = new HashMap<>(); Stream.of(5, 21, 82, 83, 3).forEach(x -> valueMap.put(x, "DOUBLE")); Stream.of(6, 35, 39, 30).forEach(x -> valueMap.put(x, "DOTTED")); Stream.of(26, 27, 28, 29, 1).forEach(x -> valueMap.put(x, "SOLID")); valueMap.put(-1, "NONE");
and then later
String lineStyleString = valueMap.get(lineStyle);
source share