KeyValueAccess kva = KeyValueAccessFactoryForTestConfig.getConnection(); List> keySets = kva.getDistinctPartitionKeys(SavepointDto.class, Integer.valueOf(50));
List<Pair<String, String>> pairs =
keySets.stream()
.sorted((k1, k2) -> SavepointUtils.compareMinitues(k1.get(1), k2.get(1)))
.sorted((k1, k2) -> k1.get(0).compareTo(k2.get(1)))
.map(keySet -> Pair.of(keySet.get(0), keySet.get(1)))
.collect(Collectors.toList());
System.out.println("\n");
int index = pairs.indexOf("2016:6:29:13:27");
for (int i = index; i < pairs.size(); i++) {
System.out.println(pairs.get(i));
}
}
I'm Having a List<Pair<String, String>>
when I'm trying to get index of any specific element from list I'm getting ArrayIndexOutofBoundException
(See above code) in my case the 1st element is date (ex: 2016:6:29:13:27
) of String
type. so can't use indexOf
or substring()
method.
Is there any other way to get all the elements from list from specific position by ignoring previous elements???
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.