|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -69,6 +69,14 @@ private Nodes() {
|
69 | 69 | private static final Node.OfLong EMPTY_LONG_NODE = new EmptyNode.OfLong();
|
70 | 70 | private static final Node.OfDouble EMPTY_DOUBLE_NODE = new EmptyNode.OfDouble();
|
71 | 71 |
|
| 72 | + /** |
| 73 | + * @return an array generator for an array whose elements are of type T. |
| 74 | + */ |
| 75 | + @SuppressWarnings("unchecked") |
| 76 | + static <T> IntFunction<T[]> castingArray() { |
| 77 | + return size -> (T[]) new Object[size]; |
| 78 | + } |
| 79 | + |
72 | 80 | // General shape-based node creation methods
|
73 | 81 |
|
74 | 82 | /**
|
@@ -554,7 +562,7 @@ public static Node.OfDouble flattenDouble(Node.OfDouble node) {
|
554 | 562 |
|
555 | 563 | // Implementations
|
556 | 564 |
|
557 |
| - private static abstract class EmptyNode<T, T_ARR, T_CONS> implements Node<T> { |
| 565 | + private abstract static class EmptyNode<T, T_ARR, T_CONS> implements Node<T> { |
558 | 566 | EmptyNode() { }
|
559 | 567 |
|
560 | 568 | @Override
|
@@ -742,7 +750,7 @@ public String toString() {
|
742 | 750 | /**
|
743 | 751 | * Node class for an internal node with two or more children
|
744 | 752 | */
|
745 |
| - private static abstract class AbstractConcNode<T, T_NODE extends Node<T>> implements Node<T> { |
| 753 | + private abstract static class AbstractConcNode<T, T_NODE extends Node<T>> implements Node<T> { |
746 | 754 | protected final T_NODE left;
|
747 | 755 | protected final T_NODE right;
|
748 | 756 | private final long size;
|
@@ -924,7 +932,7 @@ public Spliterator.OfDouble spliterator() {
|
924 | 932 | }
|
925 | 933 |
|
926 | 934 | /** Abstract class for spliterator for all internal node classes */
|
927 |
| - private static abstract class InternalNodeSpliterator<T, |
| 935 | + private abstract static class InternalNodeSpliterator<T, |
928 | 936 | S extends Spliterator<T>,
|
929 | 937 | N extends Node<T>>
|
930 | 938 | implements Spliterator<T> {
|
@@ -1106,7 +1114,7 @@ public void forEachRemaining(Consumer<? super T> consumer) {
|
1106 | 1114 | }
|
1107 | 1115 | }
|
1108 | 1116 |
|
1109 |
| - private static abstract class OfPrimitive<T, T_CONS, T_ARR, |
| 1117 | + private abstract static class OfPrimitive<T, T_CONS, T_ARR, |
1110 | 1118 | T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
|
1111 | 1119 | N extends Node.OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, N>>
|
1112 | 1120 | extends InternalNodeSpliterator<T, T_SPLITR, N>
|
@@ -1819,7 +1827,7 @@ public Node.OfDouble build() {
|
1819 | 1827 | * This and subclasses are not intended to be serializable
|
1820 | 1828 | */
|
1821 | 1829 | @SuppressWarnings("serial")
|
1822 |
| - private static abstract class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>, |
| 1830 | + private abstract static class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>, |
1823 | 1831 | K extends SizedCollectorTask<P_IN, P_OUT, T_SINK, K>>
|
1824 | 1832 | extends CountedCompleter<Void>
|
1825 | 1833 | implements Sink<P_OUT> {
|
@@ -2022,7 +2030,7 @@ public void accept(double value) {
|
2022 | 2030 | }
|
2023 | 2031 |
|
2024 | 2032 | @SuppressWarnings("serial")
|
2025 |
| - private static abstract class ToArrayTask<T, T_NODE extends Node<T>, |
| 2033 | + private abstract static class ToArrayTask<T, T_NODE extends Node<T>, |
2026 | 2034 | K extends ToArrayTask<T, T_NODE, K>>
|
2027 | 2035 | extends CountedCompleter<Void> {
|
2028 | 2036 | protected final T_NODE node;
|
|
0 commit comments