Preferences (@NotNull List<Preferences> preferences) { Set<TextMateBracePair> highlightingPairs = new HashSet<>(); Set<TextMateAutoClosingPair> smartTypingPairs = new HashSet<>(); Set<TextMateBracePair> surroundingPairs = new HashSet<>(); Set<Character> autoCloseBefore = new HashSet<>(); IndentationRules indentationRules = IndentationRules.empty(); for (Preferences preference : preferences) { final Set<TextMateBracePair> localHighlightingPairs = preference.getHighlightingPairs(); final @Nullable Set<TextMateAutoClosingPair> localSmartTypingPairs = preference.getSmartTypingPairs(); final Set<TextMateBracePair> localSurroundingPairs = preference.getSurroundingPairs(); final String localAutoCloseBefore = preference.getAutoCloseBefore(); indentationRules = indentationRules.updateWith(preference.getIndentationRules()); if (localHighlightingPairs != null) { highlightingPairs.addAll(localHighlightingPairs); } if (localSmartTypingPairs != null) { smartTypingPairs.addAll(localSmartTypingPairs); } if (localSurroundingPairs != null) { surroundingPairs.addAll(localSurroundingPairs); } if (localAutoCloseBefore != null) { for (char c : localAutoCloseBefore.toCharArray()) { autoCloseBefore.add(c); } } } return new Preferences("", highlightingPairs, smartTypingPairs, surroundingPairs, Strings.nullize(Strings.join(autoCloseBefore, "")), indentationRules); }