From 662b866f15ba32baf9a36ab10eb6c18a0a349955 Mon Sep 17 00:00:00 2001 From: David B Malkovsky Date: Sat, 25 Dec 2021 17:07:47 -0500 Subject: [PATCH] Chore: expressions with type arguments replaced with diamond type <> (#145) --- .../components/CalendarPanel.java | 16 ++++++++-------- .../components/CalendarPanelBeanInfo.java | 3 +-- .../lgooddatepicker/components/DatePicker.java | 6 +++--- .../components/DatePickerBeanInfo.java | 3 +-- .../components/DatePickerSettings.java | 6 +++--- .../components/DateTimePicker.java | 4 ++-- .../components/DateTimePickerBeanInfo.java | 3 +-- .../lgooddatepicker/components/TimePicker.java | 4 ++-- .../components/TimePickerBeanInfo.java | 3 +-- .../components/TimePickerSettings.java | 10 +++++----- .../github/lgooddatepicker/demo/FullDemo.java | 2 +- .../lgooddatepicker/demo/TableEditorsDemo.java | 2 +- .../DurationConverter.java | 2 +- .../DurationConverterSettings.java | 6 +++--- .../ysandbox/CalendarPanelAssortmentTest.java | 4 ++-- .../ysandbox/GetAllLanguages.java | 2 +- .../zinternaltools/ExtraDateStrings.java | 6 +++--- .../zinternaltools/ExtraTimeStrings.java | 2 +- .../zinternaltools/InternalUtilities.java | 2 +- .../privatejgoodies/forms/layout/ColumnSpec.java | 2 +- .../privatejgoodies/forms/layout/FormLayout.java | 10 +++++----- .../forms/layout/FormSpecParser.java | 2 +- .../privatejgoodies/forms/layout/LayoutMap.java | 12 ++++++------ .../privatejgoodies/forms/layout/RowSpec.java | 2 +- 24 files changed, 55 insertions(+), 59 deletions(-) diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java b/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java index a33b8873..89c20e6e 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java @@ -121,7 +121,7 @@ public class CalendarPanel extends JPanel { * that a date is selected in the calendar panel, or the YearMonth is changed in the calendar * panel. */ - private ArrayList calendarListeners = new ArrayList(); + private ArrayList calendarListeners = new ArrayList<>(); /** * constantFirstWeekdayLabelCell, This constant indicates the location of the first weekday @@ -413,7 +413,7 @@ private void addBorderLabels() { * This function should not depend on any settings variables. */ private void addDateLabels() { - dateLabels = new ArrayList(); + dateLabels = new ArrayList<>(); for (int i = 0; i < 42; ++i) { int dateLabelColumnX = ((i % 7)) + constantFirstDateLabelCell.x; int dateLabelRowY = ((i / 7) + constantFirstDateLabelCell.y); @@ -446,7 +446,7 @@ public void mouseLiberalClick(MouseEvent e) { * This function should not depend on any settings variables. */ private void addWeekNumberLabels() { - weekNumberLabels = new ArrayList(); + weekNumberLabels = new ArrayList<>(); int weekNumberLabelColumnX = constantFirstWeekNumberLabelCell.x; int weekNumberLabelWidthInCells = 1; int weekNumberLabelHeightInCells = 1; @@ -475,7 +475,7 @@ private void addWeekNumberLabels() { * This function should not depend on any settings variables. */ private void addWeekdayLabels() { - weekdayLabels = new ArrayList(); + weekdayLabels = new ArrayList<>(); int weekdayLabelRowY = constantFirstWeekdayLabelCell.y; int weekdayLabelWidthInCells = 1; int weekdayLabelHeightInCells = 3; @@ -713,7 +713,7 @@ public void run() { }); } // Set the days of the week labels, and create an array to represent the weekday positions. - ArrayList daysOfWeekAsDisplayed = new ArrayList(); + ArrayList daysOfWeekAsDisplayed = new ArrayList<>(); int isoFirstDayOfWeekValue = settings.getFirstDayOfWeekDisplayedOnCalendar().getValue(); int isoLastDayOfWeekOverflowed = isoFirstDayOfWeekValue + 6; int weekdayLabelArrayIndex = 0; @@ -729,7 +729,7 @@ public void run() { // Set the dates of the month labels. // Also save the label for the selected date, if one is present in the current month. // Also save the first date in each used row, for later use while displaying week numbers. - ArrayList firstDateInEachUsedRow = new ArrayList(); + ArrayList firstDateInEachUsedRow = new ArrayList<>(); boolean insideValidRange = false; int dayOfMonth = 1; JLabel selectedDateLabel = null; @@ -902,7 +902,7 @@ public void run() { * are registered with this CalendarPanel. */ public ArrayList getCalendarListeners() { - return new ArrayList(calendarListeners); + return new ArrayList<>(calendarListeners); } /** @@ -1812,7 +1812,7 @@ void zApplyVisibilityOfButtons() { private Integer zGetWeekNumberForASevenDayRange(LocalDate firstDateInRange, WeekFields weekFieldRules, boolean requireUnanimousWeekNumber) { // Get the week number for each of the seven days in the range. - ArrayList weekNumbersList = new ArrayList(); + ArrayList weekNumbersList = new ArrayList<>(); for (int daysIntoTheFuture = 0; daysIntoTheFuture <= 6; ++daysIntoTheFuture) { LocalDate currentDateInRange; // This try block handles an exception that can occur at LocalDate.MAX diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanelBeanInfo.java b/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanelBeanInfo.java index bab9983a..aa0bee70 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanelBeanInfo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanelBeanInfo.java @@ -72,8 +72,7 @@ public class CalendarPanelBeanInfo extends SimpleBeanInfo { * lowercase strings. Any properties that are not in this list, will be marked as "not * preferred". (All of the defaults for preferred properties are overwritten.) */ - private static HashSet preferredProperties = new HashSet(Arrays.asList( - "selecteddate")); + private static HashSet preferredProperties = new HashSet<>(Arrays.asList("selecteddate")); /** * propertyDescriptions, These are the descriptions to add to the properties. The key is the diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java b/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java index daf90bbb..d88cd313 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java @@ -104,7 +104,7 @@ public class DatePicker extends JPanel implements CustomPopupCloseListener { * dateChangeListeners, This holds a list of date change listeners that wish to be notified each * time that the last valid date is changed. */ - private ArrayList dateChangeListeners = new ArrayList(); + private ArrayList dateChangeListeners = new ArrayList<>(); /** * lastPopupCloseTime, This holds a timestamp that indicates when the calendar was last closed. @@ -349,7 +349,7 @@ public LocalDate getDate() { * that are registered with this DatePicker. */ public ArrayList getDateChangeListeners() { - return new ArrayList(dateChangeListeners); + return new ArrayList<>(dateChangeListeners); } /** @@ -1059,7 +1059,7 @@ public void zEventCustomPopupWasClosed(CustomPopup popup) { public void addComponentListener(ComponentListener listener) { if (componentListeners == null) { - componentListeners = new ArrayList(); + componentListeners = new ArrayList<>(); } componentListeners.add(listener); } diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerBeanInfo.java b/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerBeanInfo.java index d813169b..84eba9c0 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerBeanInfo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerBeanInfo.java @@ -72,8 +72,7 @@ public class DatePickerBeanInfo extends SimpleBeanInfo { * lowercase strings. Any properties that are not in this list, will be marked as "not * preferred". (All of the defaults for preferred properties are overwritten.) */ - private static HashSet preferredProperties = new HashSet(Arrays.asList( - "date", "text")); + private static HashSet preferredProperties = new HashSet<>(Arrays.asList("date", "text")); /** * propertyDescriptions, These are the descriptions to add to the properties. The key is the diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java b/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java index 3368a766..fb25b0ac 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java @@ -726,7 +726,7 @@ public DatePickerSettings copySettings() { result.colors = null; } else { // A shallow copy is okay here, because the map key and value are immutable types. - result.colors = new EnumMap(this.colors); + result.colors = new EnumMap<>(this.colors); } result.firstDayOfWeek = this.firstDayOfWeek; // The Font class is immutable. @@ -1832,7 +1832,7 @@ public void setLocale(Locale locale) { FormatStyle.SHORT, FormatStyle.MEDIUM, FormatStyle.LONG, FormatStyle.FULL}; // Create a set of default parsing formatters for the specified locale. - ArrayList parsingFormats = new ArrayList(); + ArrayList parsingFormats = new ArrayList<>(); DateTimeFormatter parseFormat; for (int i = 0; i < allFormatStyles.length; ++i) { parseFormat = new DateTimeFormatterBuilder().parseLenient().parseCaseInsensitive(). @@ -2335,7 +2335,7 @@ private LocalDate zGetParentSelectedDate() { * invisible. */ private ArrayList zGetDefaultBorderPropertiesList() { - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); Color defaultDateBoxBorderColor = new Color(99, 130, 191); Color defaultWeekdayEndcapsBorderColor = colorBackgroundWeekdayLabels; Color defaultWeekNumberEndcapsBorderColor = colorBackgroundWeekNumberLabels; diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java b/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java index 2453f279..b73596d1 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java @@ -72,7 +72,7 @@ public class DateTimePicker extends JPanel { * notified whenever the last valid date or the last valid time has changed. */ private ArrayList dateTimeChangeListeners - = new ArrayList(); + = new ArrayList<>(); /** * timePicker, This holds the time picker component of this DateTimePicker. @@ -168,7 +168,7 @@ public void removeDateTimeChangeListener(DateTimeChangeListener listener) { * that are registered with this DateTimePicker. */ public ArrayList getDateTimeChangeListeners() { - return new ArrayList(dateTimeChangeListeners); + return new ArrayList<>(dateTimeChangeListeners); } /** diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePickerBeanInfo.java b/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePickerBeanInfo.java index d9bdef0d..62aa5a21 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePickerBeanInfo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePickerBeanInfo.java @@ -72,8 +72,7 @@ public class DateTimePickerBeanInfo extends SimpleBeanInfo { * lowercase strings. Any properties that are not in this list, will be marked as "not * preferred". (All of the defaults for preferred properties are overwritten.) */ - private static HashSet preferredProperties = new HashSet(Arrays.asList( - "datetimepermissive", "datetimestrict")); + private static HashSet preferredProperties = new HashSet<>(Arrays.asList("datetimepermissive", "datetimestrict")); /** * propertyDescriptions, These are the descriptions to add to the properties. The key is the diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java b/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java index 0747a938..d7302c26 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java @@ -138,7 +138,7 @@ public class TimePicker * timeChangeListeners, This holds a list of time change listeners that wish to be notified * whenever the last valid time is changed. */ - private ArrayList timeChangeListeners = new ArrayList(); + private ArrayList timeChangeListeners = new ArrayList<>(); /** * timeMenuPanel, This holds the menu panel GUI component of this time picker. This should be @@ -410,7 +410,7 @@ public LocalTime getTime() { * that are registered with this TimePicker. */ public ArrayList getTimeChangeListeners() { - return new ArrayList(timeChangeListeners); + return new ArrayList<>(timeChangeListeners); } /** diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerBeanInfo.java b/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerBeanInfo.java index 9589e8c1..0517ef20 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerBeanInfo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerBeanInfo.java @@ -72,8 +72,7 @@ public class TimePickerBeanInfo extends SimpleBeanInfo { * lowercase strings. Any properties that are not in this list, will be marked as "not * preferred". (All of the defaults for preferred properties are overwritten.) */ - private static HashSet preferredProperties = new HashSet(Arrays.asList( - "time", "text")); + private static HashSet preferredProperties = new HashSet<>(Arrays.asList("time", "text")); /** * propertyDescriptions, These are the descriptions to add to the properties. The key is the diff --git a/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java b/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java index 37020b1a..428545c8 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java +++ b/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java @@ -340,7 +340,7 @@ public TimePickerSettings() { */ public TimePickerSettings(Locale timeLocale) { // Add all the default colors to the colors map. - colors = new HashMap< TimeArea, Color>(); + colors = new HashMap<>(); for (TimeArea area : TimeArea.values()) { colors.put(area, area.defaultColor); } @@ -357,7 +357,7 @@ public TimePickerSettings(Locale timeLocale) { // Generate default parsing formats. FormatStyle[] allFormatStyles = new FormatStyle[]{ FormatStyle.SHORT, FormatStyle.MEDIUM, FormatStyle.LONG, FormatStyle.FULL}; - formatsForParsing = new ArrayList(); + formatsForParsing = new ArrayList<>(); formatsForParsing.add(DateTimeFormatter.ISO_LOCAL_TIME); for (FormatStyle formatStyle : allFormatStyles) { DateTimeFormatter parseFormat = new DateTimeFormatterBuilder().parseLenient(). @@ -406,7 +406,7 @@ public void generatePotentialMenuTimes(TimeIncrement timeIncrement, LocalTime startTime = (optionalStartTime == null) ? LocalTime.MIN : optionalStartTime; LocalTime endTime = (optionalEndTime == null) ? LocalTime.MAX : optionalEndTime; // Initialize our needed variables. - potentialMenuTimes = new ArrayList(); + potentialMenuTimes = new ArrayList<>(); int increment = timeIncrement.minutes; // Start at midnight, which is the earliest time of day for LocalTime values. LocalTime entry = LocalTime.MIDNIGHT; @@ -434,11 +434,11 @@ public void generatePotentialMenuTimes(TimeIncrement timeIncrement, * by this function. */ public void generatePotentialMenuTimes(ArrayList desiredTimes) { - potentialMenuTimes = new ArrayList(); + potentialMenuTimes = new ArrayList<>(); if (desiredTimes == null || desiredTimes.isEmpty()) { return; } - TreeSet timeSet = new TreeSet(); + TreeSet timeSet = new TreeSet<>(); for (LocalTime desiredTime : desiredTimes) { if (desiredTime != null) { timeSet.add(desiredTime); diff --git a/Project/src/main/java/com/github/lgooddatepicker/demo/FullDemo.java b/Project/src/main/java/com/github/lgooddatepicker/demo/FullDemo.java index b558a2c5..5564526e 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/demo/FullDemo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/demo/FullDemo.java @@ -388,7 +388,7 @@ public static void main(String[] args) { // Create a list to hold our border properties. Borders properties will be applied to the // calendar in the order that they appear this list. ArrayList borderProperties - = new ArrayList(); + = new ArrayList<>(); // Set all borders to be yellow, and 10 pixels thick. // (Parts of the yellow border will be overwritten by other border settings.) borderProperties.add(new CalendarBorderProperties( diff --git a/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java b/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java index 548540f0..913b01a0 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java +++ b/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java @@ -202,7 +202,7 @@ private void zSetAllColumnEditorsAndRenderers(JTable table) { columnLoop: for (int columnIndex = 0; columnIndex < columnCount; ++columnIndex) { TableColumn column = table.getColumnModel().getColumn(columnIndex); - ArrayList nonNullTypes = new ArrayList(); + ArrayList nonNullTypes = new ArrayList<>(); // Loop through all the rows that should be sampled. rowLoop: for (int rowIndex = 0; (rowIndex < rowCount); diff --git a/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverter.java b/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverter.java index 6b156f0a..03975f64 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverter.java +++ b/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverter.java @@ -247,7 +247,7 @@ public static String convertStringFromDuration( private static HashSet getUsedDurationUnitSet( DurationUnit smallestUnit, DurationUnit largestUnit) { - HashSet result = new HashSet(); + HashSet result = new HashSet<>(); for (DurationUnit unit : DurationUnit.values()) { if (unit.compareTo(smallestUnit) >= 0 && unit.compareTo(largestUnit) <= 0) { result.add(unit); diff --git a/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverterSettings.java b/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverterSettings.java index c484a265..166f1033 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverterSettings.java +++ b/Project/src/main/java/com/github/lgooddatepicker/durationpicker_underconstruction/DurationConverterSettings.java @@ -62,7 +62,7 @@ private void initializeSettingsFromLocale(Locale locale) { } this.locale = locale; - translationsUnitsSingular = new HashMap(); + translationsUnitsSingular = new HashMap<>(); translationsUnitsSingular.put(DurationUnit.Second, TranslationSource.getTranslation(locale, "singular.Second", "sec")); translationsUnitsSingular.put(DurationUnit.Minute, @@ -78,7 +78,7 @@ private void initializeSettingsFromLocale(Locale locale) { translationsUnitsSingular.put(DurationUnit.Year, TranslationSource.getTranslation(locale, "singular.Year", "year")); - translationsUnitsPlural = new HashMap(); + translationsUnitsPlural = new HashMap<>(); translationsUnitsPlural.put(DurationUnit.Second, TranslationSource.getTranslation(locale, "plural.Second", "secs")); translationsUnitsPlural.put(DurationUnit.Minute, @@ -117,7 +117,7 @@ private void initializeSettingsFromLocale(Locale locale) { } public HashMap getSimplePluralUnitsMap(boolean settingForAllUnits) { - HashMap result = new HashMap(); + HashMap result = new HashMap<>(); result.put(DurationUnit.Second, settingForAllUnits); result.put(DurationUnit.Minute, settingForAllUnits); result.put(DurationUnit.Hour, settingForAllUnits); diff --git a/Project/src/main/java/com/github/lgooddatepicker/ysandbox/CalendarPanelAssortmentTest.java b/Project/src/main/java/com/github/lgooddatepicker/ysandbox/CalendarPanelAssortmentTest.java index 9a86ef15..c9364cff 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/ysandbox/CalendarPanelAssortmentTest.java +++ b/Project/src/main/java/com/github/lgooddatepicker/ysandbox/CalendarPanelAssortmentTest.java @@ -142,7 +142,7 @@ public static void main(String[] args) { dateSettings = new DatePickerSettings(); // Create a list to hold the border properties. ArrayList customPropertiesList - = new ArrayList(); + = new ArrayList<>(); // Set the borders properties for everything to Blue. CalendarBorderProperties weekdayLabelBorderProperties = new CalendarBorderProperties( new Point(3, 1), new Point(5, 5), Color.YELLOW, 5); @@ -270,7 +270,7 @@ public static void main(String[] args) { calendarPanel = new CalendarPanel(dateSettings); // Create a list to hold the border properties. ArrayList customPropertiesList2 - = new ArrayList(); + = new ArrayList<>(); // Set the borders properties for everything to Blue. CalendarBorderProperties weekdayLabelBorderProperties2 = new CalendarBorderProperties( new Point(3, 1), new Point(5, 5), Color.YELLOW, 5); diff --git a/Project/src/main/java/com/github/lgooddatepicker/ysandbox/GetAllLanguages.java b/Project/src/main/java/com/github/lgooddatepicker/ysandbox/GetAllLanguages.java index 32375ca7..36f50c05 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/ysandbox/GetAllLanguages.java +++ b/Project/src/main/java/com/github/lgooddatepicker/ysandbox/GetAllLanguages.java @@ -35,7 +35,7 @@ public class GetAllLanguages { public static void main(String[] args) { - TreeSet languageCodes = new TreeSet(); + TreeSet languageCodes = new TreeSet<>(); for (Locale locale : Locale.getAvailableLocales()) { languageCodes.add(locale.getLanguage()); diff --git a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraDateStrings.java b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraDateStrings.java index 37d1dc14..733cd6e8 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraDateStrings.java +++ b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraDateStrings.java @@ -81,7 +81,7 @@ public static ArrayList getExtraParsingFormatsForLocale(Local } // If no extra parsing formats were found, then return an empty list. - ArrayList extraParsingFormatters = new ArrayList(); + ArrayList extraParsingFormatters = new ArrayList<>(); if (definedFormats == null) { return extraParsingFormatters; } @@ -163,7 +163,7 @@ private static String getStandaloneMonthName(Month month, Locale locale, boolean private static String[] getStandaloneMonthNamesArray(Locale locale, boolean capitalize, boolean shortVersion) { Month[] monthEnums = Month.values(); - ArrayList monthNamesArrayList = new ArrayList(); + ArrayList monthNamesArrayList = new ArrayList<>(); for (Month monthEnum : monthEnums) { monthNamesArrayList.add(getStandaloneMonthName(monthEnum, locale, capitalize, shortVersion)); } @@ -209,7 +209,7 @@ private static String getFormattingMonthName(Month month, Locale locale, boolean public static String[] getFormattingMonthNamesArray(Locale locale, boolean capitalize, boolean shortVersion) { Month[] monthEnums = Month.values(); - ArrayList monthNamesArrayList = new ArrayList(); + ArrayList monthNamesArrayList = new ArrayList<>(); for (Month monthEnum : monthEnums) { monthNamesArrayList.add(getFormattingMonthName( monthEnum, locale, capitalize, shortVersion)); diff --git a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraTimeStrings.java b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraTimeStrings.java index aadbdec8..689aaf61 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraTimeStrings.java +++ b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/ExtraTimeStrings.java @@ -57,7 +57,7 @@ public static ArrayList getExtraTimeParsingFormatsForLocale(L } // If no extra parsing formats were found, then return an empty list. - ArrayList extraParsingFormatters = new ArrayList(); + ArrayList extraParsingFormatters = new ArrayList<>(); if (definedFormats == null) { return extraParsingFormatters; } diff --git a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java index d4e66a0b..f8a1e3e5 100644 --- a/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java +++ b/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java @@ -167,7 +167,7 @@ public static T getMostCommonElementInList(List sourceList) { if (sourceList == null || sourceList.isEmpty()) { return null; } - Map hashMap = new HashMap(); + Map hashMap = new HashMap<>(); for (T element : sourceList) { Integer countOrNull = hashMap.get(element); int newCount = (countOrNull == null) ? 1 : (countOrNull + 1); diff --git a/Project/src/main/java/com/privatejgoodies/forms/layout/ColumnSpec.java b/Project/src/main/java/com/privatejgoodies/forms/layout/ColumnSpec.java index ab3424bc..030a8d9d 100644 --- a/Project/src/main/java/com/privatejgoodies/forms/layout/ColumnSpec.java +++ b/Project/src/main/java/com/privatejgoodies/forms/layout/ColumnSpec.java @@ -93,7 +93,7 @@ public final class ColumnSpec extends FormSpec { * Maps encoded column specifications to ColumnSpec instances. */ private static final Map CACHE - = new HashMap(); + = new HashMap<>(); // Instance Creation **************************************************** /** diff --git a/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java b/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java index f325cb32..611e33d4 100644 --- a/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java +++ b/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java @@ -413,12 +413,12 @@ public FormLayout(ColumnSpec[] colSpecs) { public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs) { checkNotNull(colSpecs, "The column specifications must not be null."); checkNotNull(rowSpecs, "The row specifications must not be null."); - this.colSpecs = new ArrayList(Arrays.asList(colSpecs)); - this.rowSpecs = new ArrayList(Arrays.asList(rowSpecs)); + this.colSpecs = new ArrayList<>(Arrays.asList(colSpecs)); + this.rowSpecs = new ArrayList<>(Arrays.asList(rowSpecs)); colGroupIndices = new int[][]{}; rowGroupIndices = new int[][]{}; int initialCapacity = colSpecs.length * rowSpecs.length / 4; - constraintMap = new HashMap(initialCapacity); + constraintMap = new HashMap<>(initialCapacity); componentSizeCache = new ComponentSizeCache(initialCapacity); minimumWidthMeasure = new MinimumWidthMeasure(componentSizeCache); minimumHeightMeasure = new MinimumHeightMeasure(componentSizeCache); @@ -1786,8 +1786,8 @@ private static final class ComponentSizeCache implements Serializable { * @param initialCapacity the initial cache capacity */ private ComponentSizeCache(int initialCapacity) { - minimumSizes = new HashMap(initialCapacity); - preferredSizes = new HashMap(initialCapacity); + minimumSizes = new HashMap<>(initialCapacity); + preferredSizes = new HashMap<>(initialCapacity); } /** diff --git a/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java b/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java index 7772970f..397e7324 100644 --- a/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java +++ b/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpecParser.java @@ -130,7 +130,7 @@ private RowSpec[] parseRowSpecs() { // Parser Implementation ************************************************** private List split(String expression, int offset) { - List encodedSpecs = new ArrayList(); + List encodedSpecs = new ArrayList<>(); int parenthesisLevel = 0; // number of open '(' int bracketLevel = 0; // number of open '[' int quoteLevel = 0; // number of open '\'' diff --git a/Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java b/Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java index ee70dd4f..94447533 100644 --- a/Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java +++ b/Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java @@ -130,13 +130,13 @@ public final class LayoutMap { * {@code "rgap"} -> {@code "related-gap"}. */ private static final Map COLUMN_ALIASES - = new HashMap(); + = new HashMap<>(); /** * Maps row aliases to their default name, for example {@code "rgap"} -> {@code "related-gap"}. */ private static final Map ROW_ALIASES - = new HashMap(); + = new HashMap<>(); /** * Holds the lazily initialized root map. @@ -189,10 +189,10 @@ public LayoutMap() { */ public LayoutMap(LayoutMap parent) { this.parent = parent; - columnMap = new HashMap(); - rowMap = new HashMap(); - columnMapCache = new HashMap(); - rowMapCache = new HashMap(); + columnMap = new HashMap<>(); + rowMap = new HashMap<>(); + columnMapCache = new HashMap<>(); + rowMapCache = new HashMap<>(); } // Default **************************************************************** diff --git a/Project/src/main/java/com/privatejgoodies/forms/layout/RowSpec.java b/Project/src/main/java/com/privatejgoodies/forms/layout/RowSpec.java index 7887441d..74265419 100644 --- a/Project/src/main/java/com/privatejgoodies/forms/layout/RowSpec.java +++ b/Project/src/main/java/com/privatejgoodies/forms/layout/RowSpec.java @@ -91,7 +91,7 @@ public final class RowSpec extends FormSpec { * Maps encoded row specifications to RowSpec instances. */ private static final Map CACHE - = new HashMap(); + = new HashMap<>(); // Instance Creation **************************************************** /**