Hi Can anyone help me in understanding the following line of code?
private Map<EnumType, Pair<Long, Long>> processToProductLineAndIndustryMap = new EnumMap<EnumType, Pair<Long, Long>>(
Collections.unmodifiableMap(Stream.of(
new SimpleEntry<>(EnumType.SOME_TYPE,
Pair.of(Question.getProductLineQuestionId(), Question.getAdvertiserIndustryQuestionId())))
.collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue()))));
I am new to this. Have went through several articles online but could not able to figure out.
I want to create an unmodifiable map<EnumType, Pair<Long, Long>>. Based on enumtype i want to get the pair of Longs and see if it contains a particular long or not. Please help me in figuring out the best data structure for my usecase
EnumMaps constructor.Collections.unmodifiableMapdoesn't do anything. This appears to be a complicated way to create a map with one entry.