Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8206122

Use Queue in place of ArrayList when need to remove first element

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 12
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b03

      Description

      There are couple of places where ArrayList is used a FIFO structure.
      Using ArrayDeque would be more efficient.

      src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskPool.java
          private final Map<List<String>, List<ReusableContext>> options2Contexts;
      (value type is in fact ArrayList)

      src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
              Map<ClassSymbol, ArrayList<RewritingContext>> Q = new HashMap<>();

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                igerasim Ivan Gerasimov
                Reporter:
                igerasim Ivan Gerasimov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: