Bug 2907 - corrections for upgrade to karaf 3.0.3
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / LfLst.java
index 7688f2ed22bdf3817785cc368d6bd1cf0f0b7a44..719adf73bb5d834cc0e740d4c5378f0430f15258 100644 (file)
@@ -1,6 +1,14 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.restconf.impl.test.structures;
 
-import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
 
 public class LfLst extends YangElement {
     Set<Lf> lfs;
@@ -10,8 +18,15 @@ public class LfLst extends YangElement {
         lfs = new HashSet<>();
     }
 
+    public LfLst addLf(Object value) {
+        return addLf(new Lf(value));
+    }
+
     public LfLst addLf(Lf lf) {
-        lfs.add(lf);
+        while (this.lfs.contains(lf)) {
+            lf.incNumOfEqualItems();
+        }
+        this.lfs.add(lf);
         return this;
     }
 
@@ -31,7 +46,11 @@ public class LfLst extends YangElement {
             return false;
         }
         LfLst lfLst = (LfLst) obj;
-        if (!this.lfs.equals(lfLst.lfs)) {
+        if (this.lfs == null) {
+            if (lfLst.lfs != null) {
+                return false;
+            }
+        } else if (!this.lfs.equals(lfLst.lfs)) {
             return false;
         }
         return true;