Skip to content

Commit

Permalink
Tighten override for the specific list to avoid calling every call "g…
Browse files Browse the repository at this point in the history
…et" on generic lists (specificially LinkedList) in a loop.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=242905286
  • Loading branch information
concavelenz authored and lauraharker committed Apr 11, 2019
1 parent 4de8ada commit 42e766b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/com/google/javascript/rhino/jstype/UnionTypeBuilder.java
Expand Up @@ -157,7 +157,9 @@ public UnionTypeBuilder addAlternates(Collection<JSType> c) {
return this;
}

public UnionTypeBuilder addAlternates(List<JSType> list) {
// A specific override that avoid creating an iterator. This version is currently used when
// adding a union as an alternate.
public UnionTypeBuilder addAlternates(ImmutableList<JSType> list) {
for (int i = 0; i < list.size(); i++) {
addAlternate(list.get(i));
}
Expand Down

0 comments on commit 42e766b

Please sign in to comment.