OLD | NEW |
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 15 matching lines...) Expand all Loading... |
26 * | 26 * |
27 * Note: if [o1] is an [Optional], this can be accomplished with `o1.or(o2)`. | 27 * Note: if [o1] is an [Optional], this can be accomplished with `o1.or(o2)`. |
28 */ | 28 */ |
29 firstNonNull(o1, o2, [o3, o4]) { | 29 firstNonNull(o1, o2, [o3, o4]) { |
30 if (o1 != null) return o1; | 30 if (o1 != null) return o1; |
31 if (o2 != null) return o2; | 31 if (o2 != null) return o2; |
32 if (o3 != null) return o3; | 32 if (o3 != null) return o3; |
33 if (o4 != null) return o4; | 33 if (o4 != null) return o4; |
34 throw new ArgumentError('All arguments were null'); | 34 throw new ArgumentError('All arguments were null'); |
35 } | 35 } |
OLD | NEW |