diff options
author | Chiachang Wang <chiachangwang@google.com> | 2019-02-22 05:12:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-02-22 05:12:42 +0000 |
commit | 09d3ac4e8d6ea46d618043c6c1f405d715df8665 (patch) | |
tree | 6b2af8c13082555d9ece1a7870ba7c67174647c2 /src/android/net/util/NetworkStackUtils.java | |
parent | c3edab27d52c43a3502df97452213090b45f5b4c (diff) | |
parent | 8b5f84ac9c08f27bea6fcbfacbabcfda8773ea07 (diff) |
Merge "Injecting data stall event to statsd"
Diffstat (limited to 'src/android/net/util/NetworkStackUtils.java')
-rw-r--r-- | src/android/net/util/NetworkStackUtils.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/android/net/util/NetworkStackUtils.java b/src/android/net/util/NetworkStackUtils.java index 98123a5..481dbda 100644 --- a/src/android/net/util/NetworkStackUtils.java +++ b/src/android/net/util/NetworkStackUtils.java @@ -16,8 +16,11 @@ package android.net.util; +import android.annotation.NonNull; + import java.io.FileDescriptor; import java.io.IOException; +import java.util.List; /** * Collection of utilities for the network stack. @@ -40,4 +43,26 @@ public class NetworkStackUtils { } catch (IOException ignored) { } } + + /** + * Returns an int array from the given Integer list. + */ + public static int[] convertToIntArray(@NonNull List<Integer> list) { + int[] array = new int[list.size()]; + for (int i = 0; i < list.size(); i++) { + array[i] = list.get(i); + } + return array; + } + + /** + * Returns a long array from the given long list. + */ + public static long[] convertToLongArray(@NonNull List<Long> list) { + long[] array = new long[list.size()]; + for (int i = 0; i < list.size(); i++) { + array[i] = list.get(i); + } + return array; + } } |