This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 34961
Collapse All | Expand All

(-)lookup/SimpleProxyLookup.java (-12 / +17 lines)
Lines 137-157 Link Here
137
            
137
            
138
            Collection newPairs = delegate.allItems ();
138
            Collection newPairs = delegate.allItems ();
139
            
139
            
140
            // See #34961 for explanation.
140
            return !collectionEqual (oldPairs, newPairs);
141
            if (!(oldPairs instanceof List)) {
141
        }
142
                if (oldPairs == Collections.EMPTY_SET) {
142
        
143
                    // avoid allocation
143
        /** Utility method to compare two collections.
144
                    oldPairs = Collections.EMPTY_LIST;
144
         * See #34961 for explanation.
145
                } else {
145
         * @param c1 collection
146
                    oldPairs = new ArrayList(oldPairs);
146
         * @param c2 collection
147
                }
147
         * @return true if the content is the same
148
         */
149
        private boolean collectionEqual (Collection c1, Collection c2) {
150
            int s1 = c1.size ();
151
            int s2 = c2.size ();
152
            if (s1 != s2) {
153
                return false;
148
            }
154
            }
149
            if (!(newPairs instanceof List)) {
155
            if (s1 == 0) {
150
                newPairs = new ArrayList(newPairs);
156
                return true;
151
            }
157
            }
152
            return !oldPairs.equals (newPairs);
158
            return Arrays.equals (c1.toArray(), c2.toArray());
153
        }
159
        }
154
        
155
        
160
        
156
        public synchronized void addLookupListener(LookupListener l) {
161
        public synchronized void addLookupListener(LookupListener l) {
157
            if (listeners == null) {
162
            if (listeners == null) {

Return to bug 34961