From 5b420e1f9c35787d8bc39d7bfd895dab2d0d50c5 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Fri, 1 Apr 2016 15:31:42 +0300 Subject: [PATCH] vcs: Refactored "LocalChangeListImpl" - explicitly use "Set"s to operate with changes --- .../openapi/vcs/changes/LocalChangeListImpl.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java index 940e77cdf337..a57de91b8265 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java @@ -25,8 +25,8 @@ public class LocalChangeListImpl extends LocalChangeList { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.ChangeList"); private final Project myProject; - private Collection myChanges = new HashSet(); - private Collection myReadChangesCache = null; + private Set myChanges = ContainerUtil.newHashSet(); + private Set myReadChangesCache = null; private String myId; @NotNull private String myName; private String myComment = ""; @@ -53,14 +53,15 @@ public class LocalChangeListImpl extends LocalChangeList { setNameImpl(origin.myName); } - public Collection getChanges() { + @NotNull + public Set getChanges() { createReadChangesCache(); return myReadChangesCache; } private void createReadChangesCache() { if (myReadChangesCache == null) { - myReadChangesCache = Collections.unmodifiableCollection(new HashSet(myChanges)); + myReadChangesCache = Collections.unmodifiableSet(ContainerUtil.newHashSet(myChanges)); } } @@ -275,7 +276,7 @@ public class LocalChangeListImpl extends LocalChangeList { copy.myData = myData; if (myChanges != null) { - copy.myChanges = new HashSet(myChanges); + copy.myChanges = ContainerUtil.newHashSet(myChanges); } if (myChangesBeforeUpdate != null) { @@ -283,7 +284,7 @@ public class LocalChangeListImpl extends LocalChangeList { } if (myReadChangesCache != null) { - copy.myReadChangesCache = new HashSet(myReadChangesCache); + copy.myReadChangesCache = ContainerUtil.newHashSet(myReadChangesCache); } return copy;