blob: f76e66ae52db6f521395508d6c49850427d2e251 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Yuta HIGUCHI39ede6a2014-10-03 15:23:33 -070016package org.onlab.onos.net;
17
Thomas Vachuska442d26a2014-10-31 08:45:14 -070018/**
19 * Utility for processing annotations.
20 */
Yuta HIGUCHI39ede6a2014-10-03 15:23:33 -070021public final class AnnotationsUtil {
22
23 public static boolean isEqual(Annotations lhs, Annotations rhs) {
24 if (lhs == rhs) {
25 return true;
26 }
27 if (lhs == null || rhs == null) {
28 return false;
29 }
30
31 if (!lhs.keys().equals(rhs.keys())) {
32 return false;
33 }
34
35 for (String key : lhs.keys()) {
36 if (!lhs.value(key).equals(rhs.value(key))) {
37 return false;
38 }
39 }
40 return true;
41 }
42
43 // not to be instantiated
44 private AnnotationsUtil() {}
45}