Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 container of a reference to pass data into or out from a closure. This clas s is usually useful | |
|
Lambros
2016/05/27 22:26:07
This should go in a 'util' subpackage. Maybe call
Hzj_jie
2016/05/28 00:32:07
Done.
| |
| 9 * in test cases. | |
| 10 * | |
| 11 * @param <T> The type of reference. | |
| 12 */ | |
| 13 public class Pointer<T> { | |
| 14 private T mRef; | |
| 15 | |
| 16 public Pointer() { | |
| 17 clear(); | |
| 18 } | |
| 19 | |
| 20 public Pointer(T ref) { | |
| 21 set(ref); | |
| 22 } | |
| 23 | |
| 24 public void clear() { | |
| 25 set(null); | |
| 26 } | |
| 27 | |
| 28 public void set(T ref) { | |
| 29 mRef = ref; | |
| 30 } | |
| 31 | |
| 32 public T get() { | |
| 33 return mRef; | |
| 34 } | |
| 35 } | |
| OLD | NEW |