Source:
static void upgradeColumnPreferences(JabRefPreferences preferences) { List<String> columnNames = preferences.getStringList(JabRefPreferences.COLUMN_NAMES); List<Double> columnWidths = preferences.getStringList(JabRefPreferences.COLUMN_WIDTHS) .stream() .map(string -> { try { return Double.parseDouble(string); } catch (NumberFormatException e) { return ColumnPreferences.DEFAULT_COLUMN_WIDTH; } }) .collect(Collectors.toList()); String normalFieldTypeString = MainTableColumnModel.Type.NORMALFIELD.getName() + MainTableColumnModel.COLUMNS_QUALIFIER_DELIMITER; if (!columnNames.isEmpty() && columnNames.stream().noneMatch(name -> name.contains(normalFieldTypeString))) { List<MainTableColumnModel> columns = new ArrayList<>(); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.GROUPS)); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.FILES)); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.LINKED_IDENTIFIER)); for (int i = 0; i < columnNames.size(); i++) { String name = columnNames.get(i); Double columnWidth = ColumnPreferences.DEFAULT_COLUMN_WIDTH; MainTableColumnModel.Type type = SpecialField.fromName(name) .map(field -> MainTableColumnModel.Type.SPECIALFIELD) .orElse(MainTableColumnModel.Type.NORMALFIELD); if (i < columnWidths.size()) { columnWidth = columnWidths.get(i); } columns.add(new MainTableColumnModel(type, name, columnWidth)); } preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columns.stream() .map(MainTableColumnModel::getName) .collect(Collectors.toList())); preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columns.stream() .map(MainTableColumnModel::getWidth) .map(Double::intValue) .map(Object::toString) .collect(Collectors.toList())); preferences.putStringList(JabRefPreferences.COLUMN_SORT_TYPES, columns.stream() .map(MainTableColumnModel::getSortType) .map(TableColumn.SortType::toString) .collect(Collectors.toList())); } }

Target:
static void upgradeColumnPreferences(JabRefPreferences preferences) { List<String> columnNames = preferences.getStringList(JabRefPreferences.COLUMN_NAMES); List<Double> columnWidths = preferences.getStringList(JabRefPreferences.COLUMN_WIDTHS) .stream() .map(string -> { try { return Double.parseDouble(string); } catch (NumberFormatException e) { return ColumnPreferences.DEFAULT_COLUMN_WIDTH; } }) .collect(Collectors.toList()); String normalFieldTypeString = MainTableColumnModel.Type.NORMALFIELD.getName() + MainTableColumnModel.COLUMNS_QUALIFIER_DELIMITER; if (!columnNames.isEmpty() && columnNames.stream().noneMatch(name -> name.contains(normalFieldTypeString))) { List<MainTableColumnModel> columns = new ArrayList<>(); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.GROUPS)); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.FILES)); columns.add(new MainTableColumnModel(MainTableColumnModel.Type.LINKED_IDENTIFIER)); for (int i = 0; i < columnNames.size(); i++) { String name = columnNames.get(i); double columnWidth = ColumnPreferences.DEFAULT_COLUMN_WIDTH; MainTableColumnModel.Type type = SpecialField.fromName(name) .map(field -> MainTableColumnModel.Type.SPECIALFIELD) .orElse(MainTableColumnModel.Type.NORMALFIELD); if (i < columnWidths.size()) { columnWidth = columnWidths.get(i); } columns.add(new MainTableColumnModel(type, name, columnWidth)); } preferences.putStringList(JabRefPreferences.COLUMN_NAMES, columns.stream() .map(MainTableColumnModel::getName) .collect(Collectors.toList())); preferences.putStringList(JabRefPreferences.COLUMN_WIDTHS, columns.stream() .map(MainTableColumnModel::getWidth) .map(Double::intValue) .map(Object::toString) .collect(Collectors.toList())); ENDING by default preferences.putStringList(JabRefPreferences.COLUMN_SORT_TYPES, columns.stream() .map(MainTableColumnModel::getSortType) .map(TableColumn.SortType::toString) .collect(Collectors.toList())); } }