Skip to content

AlternatingDinerMenuIterator uses Calendar.DAY_OF_WEEK incorrectly #45

Description

@prashantpiyush1111

The constructor uses Calendar.DAY_OF_WEEK as if it represents the current day:

position = Calendar.DAY_OF_WEEK % 2;

However, Calendar.DAY_OF_WEEK is a field identifier constant, not the actual current day-of-week value. Therefore, this expression always produces the same starting position.

As a result, the iterator does not change its starting position based on the current day as intended.

Please retrieve the actual day-of-week value:

position = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) % 2;

This will make the iterator's starting position depend on the actual current day.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions