Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/Preconditions.java

Issue 1999583002: Add Event and EventTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use only a Set instead of a Set and a List Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chromoting;
6
7 /**
8 * A set of helper functions to write assertions. These functions are always bei ng executed, and
9 * will not ignored in release build.
10 */
11
12 public final class Preconditions {
13 // This class contains only static functions, so it should not be instantiat ed.
14 private Preconditions() {}
15
16 // Checks whether input |v| is true, and returns its value. Throws
Lambros 2016/05/27 00:38:52 s/v/value Why bother returning the value if it's
Hzj_jie 2016/05/27 02:55:20 I think it's more helpful in the following scenari
17 // {@link IllegalStateException} if |v| is false.
18 public static final boolean isTrue(boolean v) {
19 if (!v) {
20 throw new IllegalStateException();
21 }
22 return v;
23 }
24
25 // Checks whether input |ref| is not a null reference, and return its value. Throws
26 // {@link NullPointerException} if |ref| is null.
27 public static final <T> T notNull(T ref) {
28 if (ref == null) {
29 throw new NullPointerException();
30 }
31 return ref;
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698