0

次のコードがあります。

DateFormat df = new SimpleDateFormat("EEEEE, LLLL d", Locale.US);
String[] suspendedDates = {
        "Tuesday, January 1",
        "Monday, January 21",
        "Sunday, February 10",
        "Tuesday, February 12",
        "Wednesday, February 13",
        "Monday, February 18",
        "Sunday, February 24",
        "Tuesday, March 26",
        "Wednesday, March 27",
        "Thursday, March 28",
        "Friday, March 29",
        "Monday, April 1",
        "Tuesday, April 2",
        "Thursday, May 2",
        "Friday, May 3",
        "Thursday, May 9",
        "Wednesday, May 15",
        "Thursday, May 16",
        "Monday, May 27",
        "Thursday, July 4",
        "Wednesday, August 7",
        "Thursday, August 8",
        "Friday, August 9",
        "Thursday, August 15",
        "Monday, September 2",
        "Thursday, September 5",
        "Friday, September 6",
        "Saturday, September 14",
        "Thursday, September 19",
        "Friday, September 20",
        "Thursday, September 26",
        "Friday, September 27",
        "Monday, October 14",
        "Tuesday, October 15",
        "Wednesday, October 16",
        "Thursday, October 17",
        "Friday, November 1",
        "Sunday, November 3",
        "Tuesday, November 5",
        "Monday, November 11",
        "Thursday, November 28",
        "Sunday, December 8",
        "Wednesday, December 25"
};

次の行は比較して、一致する場合は true を返します。

Arrays.asList(suspendedDates).contains(df.format(Calendar.getInstance(Locale.US).getTime()))

私が知りたいのは、どのインデックスで一致するかを確認する方法です。

4

1 に答える 1