Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-pr
    • Labels:
      None

      Activity

      Hide
      jitu added a comment -

      Checked with SE team regarding Iterable. Here is a comment

      "While the specifications do not require that an Iterable can be iterated repeatedly/consistently, many users expect this and are likely to be confused if they cannot.

      If you do not intend iterator() to return a fresh "rewound" view every time, then you should probably follow the convention set by Socket.getInputStream(), which returns the same stream on every call.

      You definitely don't want to implement Iterator; a parser is-not-a Iterator. One option would be to have an iterator() method but not implement Iterable, where the iterator() method was spec'ed to behave as above – just return the same Iterator object every time. All you lose there is the foreach loop support – no big deal.

      Overall I think you sow more confusion than benefit by implementing Iterable.

      When you get to EE 8 you can implement Streamable too!"

      Based on this, added iterator() method.

      Show
      jitu added a comment - Checked with SE team regarding Iterable. Here is a comment "While the specifications do not require that an Iterable can be iterated repeatedly/consistently, many users expect this and are likely to be confused if they cannot. If you do not intend iterator() to return a fresh "rewound" view every time, then you should probably follow the convention set by Socket.getInputStream(), which returns the same stream on every call. You definitely don't want to implement Iterator; a parser is-not-a Iterator. One option would be to have an iterator() method but not implement Iterable, where the iterator() method was spec'ed to behave as above – just return the same Iterator object every time. All you lose there is the foreach loop support – no big deal. Overall I think you sow more confusion than benefit by implementing Iterable. When you get to EE 8 you can implement Streamable too!" Based on this, added iterator() method.

        People

        • Assignee:
          jitu
          Reporter:
          jitu
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: