OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 @Override | 43 @Override |
44 public boolean equals(Object other) { | 44 public boolean equals(Object other) { |
45 if (this == other) { | 45 if (this == other) { |
46 return true; | 46 return true; |
47 } | 47 } |
48 if (other == null || getClass() != other.getClass()) { | 48 if (other == null || getClass() != other.getClass()) { |
49 return false; | 49 return false; |
50 } | 50 } |
51 KeyValuePair that = (KeyValuePair)other; | 51 KeyValuePair that = (KeyValuePair) other; |
52 return key.equals(that.key) && value.equals(that.value); | 52 return key.equals(that.key) && value.equals(that.value); |
53 } | 53 } |
54 | 54 |
55 @Override | 55 @Override |
56 public int hashCode() { | 56 public int hashCode() { |
57 return key.hashCode() + value.hashCode(); | 57 return key.hashCode() + value.hashCode(); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 public final List<KeyValuePair> mandatory; | 61 public final List<KeyValuePair> mandatory; |
62 public final List<KeyValuePair> optional; | 62 public final List<KeyValuePair> optional; |
63 | 63 |
64 public MediaConstraints() { | 64 public MediaConstraints() { |
65 mandatory = new LinkedList<KeyValuePair>(); | 65 mandatory = new LinkedList<KeyValuePair>(); |
66 optional = new LinkedList<KeyValuePair>(); | 66 optional = new LinkedList<KeyValuePair>(); |
67 } | 67 } |
68 | 68 |
69 private static String stringifyKeyValuePairList(List<KeyValuePair> list) { | 69 private static String stringifyKeyValuePairList(List<KeyValuePair> list) { |
70 StringBuilder builder = new StringBuilder("["); | 70 StringBuilder builder = new StringBuilder("["); |
71 for (KeyValuePair pair : list) { | 71 for (KeyValuePair pair : list) { |
72 if (builder.length() > 1) { | 72 if (builder.length() > 1) { |
73 builder.append(", "); | 73 builder.append(", "); |
74 } | 74 } |
75 builder.append(pair.toString()); | 75 builder.append(pair.toString()); |
76 } | 76 } |
77 return builder.append("]").toString(); | 77 return builder.append("]").toString(); |
78 } | 78 } |
79 | 79 |
80 public String toString() { | 80 public String toString() { |
81 return "mandatory: " + stringifyKeyValuePairList(mandatory) + | 81 return "mandatory: " + stringifyKeyValuePairList(mandatory) + ", optional: " |
82 ", optional: " + stringifyKeyValuePairList(optional); | 82 + stringifyKeyValuePairList(optional); |
83 } | 83 } |
84 } | 84 } |
OLD | NEW |