Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Seriously, is there a more annoying pattern than the following?

      for (int i = 0; i < t.size(); i++) {
          try {
              doStuff(t.get(i));
          } catch (ExecException e) {
              throw new RuntimeException("BUT I THOUGHT PIG WAS SINGLETHREADED", e);
          }
      }
      

      I mean yeah, you can do the following:

      for (Object o : t.getAll()) {
          doStuff(o);
      }
      

      But I don't even think that should be necessary. I think the following should work:

      for (Object o : t) {
          doStuff(o);
      }
      

      It's a shame we can't give a default implementation (I either shake my fist that this won't be possible until Java 8 OR that Tuple is an interface and not an abstract class). Either way, I even added test! WOAH.

      Thoughts?

        Attachments

        1. PIG-2724-0.patch
          5 kB
          Jonathan Coveney
        2. PIG-2724-1.patch
          16 kB
          Jonathan Coveney
        3. PIG-2724-1.patch
          16 kB
          Jonathan Coveney
        4. PIG-2724-2.patch
          15 kB
          Jonathan Coveney
        5. PIG-2724-3.patch
          21 kB
          Jonathan Coveney
        6. PIG-2724-4.patch
          14 kB
          Jonathan Coveney
        7. PIG-2724-4.patch
          14 kB
          Jonathan Coveney
        8. PIG-2724-5.patch
          14 kB
          Jonathan Coveney
        9. PIG-2724-6.patch
          22 kB
          Jonathan Coveney
        10. PIG-2724-6.patch
          16 kB
          Jonathan Coveney
        11. PIG-2724-7.patch
          14 kB
          Jonathan Coveney

          Activity

            People

            • Assignee:
              jcoveney Jonathan Coveney
              Reporter:
              jcoveney Jonathan Coveney
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: