| | |
| | | DynamicNode[][] dynamicMatrix = getDynamicMatrix(lev); |
| | | String[][] codeMatrix = this.getCodeMatrix(lev); |
| | | |
| | | // concurrent |
| | | ConcurrentLinkedQueue<SortCodeDto> codeList = new ConcurrentLinkedQueue<>(); |
| | | |
| | | IntStream.range(0, codeMatrix.length).parallel().forEach(i -> { |
| | | for (int j = 0; j < codeMatrix[i].length; j++) { |
| | | DynamicNode dynamicNode = dynamicMatrix[i][j]; |
| | |
| | | } |
| | | }); |
| | | |
| | | return codeList.stream() |
| | | .sorted(Comparator.comparingInt(SortCodeDto::getSerial)) |
| | | .map(SortCodeDto::getCode) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // synchronize |
| | | // List<SortCodeDto> codeList = new ArrayList<>(); |
| | | |
| | | // for (int i = 0; i < codeMatrix.length; i++) { |
| | | // for (int j = 0; j < codeMatrix[i].length; j++) { |
| | | // DynamicNode dynamicNode = dynamicMatrix[i][j]; |
| | |
| | | // } |
| | | // } |
| | | // } |
| | | // codeList.sort(Comparator.comparingInt(SortCodeDto::getSerial)); |
| | | // return codeList.stream().map(SortCodeDto::getCode).collect(Collectors.toList()); |
| | | |
| | | return codeList.stream() |
| | | .sorted(Comparator.comparingInt(SortCodeDto::getSerial)) |
| | | .map(SortCodeDto::getCode) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | public void modifyDynamicMatrix(Integer lev, List<int[]> codeIdxList, String vehicle) { |