aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogdan Drutu <bdrutu@google.com>2018-09-24 09:47:29 -0700
committerGitHub <noreply@github.com>2018-09-24 09:47:29 -0700
commit648d7728e6b573d700da87b25236104edebc8c75 (patch)
treec92b03f6e66736d4a2b42842d320269fe7ce2514
parent35c4b3d65a2bbcd073a7f7b70dd4e8a17165d334 (diff)
downloadopencensus-java-648d7728e6b573d700da87b25236104edebc8c75.tar.gz
Avoid using LinkedList and remove couple SuppressWarnings. (#1469)
-rw-r--r--impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
index 7368a161..80f60ce4 100644
--- a/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
+++ b/impl_core/src/main/java/io/opencensus/implcore/stats/MutableViewData.java
@@ -45,9 +45,9 @@ import io.opencensus.stats.View;
import io.opencensus.stats.ViewData;
import io.opencensus.tags.TagContext;
import io.opencensus.tags.TagValue;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -223,9 +223,7 @@ abstract class MutableViewData {
// TODO(songya): allow customizable bucket size in the future.
private static final int N = 4; // IntervalView has N + 1 buckets
- // TODO(sebright): Decide whether to use a different class instead of LinkedList.
- @SuppressWarnings("JdkObsolete")
- private final LinkedList<IntervalBucket> buckets = new LinkedList<IntervalBucket>();
+ private final ArrayDeque<IntervalBucket> buckets = new ArrayDeque<IntervalBucket>();
private final Duration totalDuration; // Duration of the whole interval.
private final Duration bucketDuration; // Duration of a single bucket (totalDuration / N)
@@ -352,9 +350,7 @@ abstract class MutableViewData {
Multimap<List</*@Nullable*/ TagValue>, MutableAggregation> multimap =
LinkedHashMultimap.create();
- // TODO(sebright): Decide whether to use a different class instead of LinkedList.
- @SuppressWarnings("JdkObsolete")
- LinkedList<IntervalBucket> shallowCopy = new LinkedList<IntervalBucket>(buckets);
+ ArrayDeque<IntervalBucket> shallowCopy = new ArrayDeque<IntervalBucket>(buckets);
Aggregation aggregation = super.view.getAggregation();
Measure measure = super.view.getMeasure();
@@ -367,7 +363,7 @@ abstract class MutableViewData {
// Put stats within each bucket to a multimap. Each tag value list (map key) could have multiple
// mutable aggregations (map value) from different buckets.
private static void putBucketsIntoMultiMap(
- LinkedList<IntervalBucket> buckets,
+ ArrayDeque<IntervalBucket> buckets,
Multimap<List</*@Nullable*/ TagValue>, MutableAggregation> multimap,
Aggregation aggregation,
Measure measure,