boolean[][] (CatchSectionWrapper @NotNull [] sections) { final boolean[][] canSwap = new boolean[sections.length][sections.length]; for (int from = 0; from < sections.length; from++) { for (int to = from + 1; to < sections.length; to++) { canSwap[from][to] = canSwap[to][from] = sections[from] != null && sections[from].canSwapWith(sections[to]); } } return canSwap; }