diff --git a/api/src/main/java/org/eclipse/daanse/olap/api/Context.java b/api/src/main/java/org/eclipse/daanse/olap/api/Context.java index 7dd2ee0..a371926 100644 --- a/api/src/main/java/org/eclipse/daanse/olap/api/Context.java +++ b/api/src/main/java/org/eclipse/daanse/olap/api/Context.java @@ -13,8 +13,6 @@ */ package org.eclipse.daanse.olap.api; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -44,7 +42,7 @@ */ public interface Context { - List KEYWORD_LIST = Collections.unmodifiableList(Arrays.asList("$AdjustedProbability", + List KEYWORD_LIST = List.of("$AdjustedProbability", "$Distance", "$Probability", "$ProbabilityStDev", "$ProbabilityStdDeV", "$ProbabilityVariance", "$StDev", "$StdDeV", "$Support", "$Variance", "AddCalculatedMembers", "Action", "After", "Aggregate", "All", "Alter", "Ancestor", "And", "Append", "As", "ASC", "Axis", "Automatic", "Back_Color", "BASC", "BDESC", "Before", @@ -78,7 +76,7 @@ public interface Context { "Solve_Order", "Sort", "StdDev", "Stdev", "StripCalculatedMembers", "StrToSet", "StrToTuple", "SubSet", "Support", "Tail", "Text", "Thresholds", "ToggleDrillState", "TopCount", "TopPercent", "TopSum", "TupleToStr", "Under", "Uniform", "UniqueName", "Use", "Value", "Var", "Variance", "VarP", "VarianceP", - "VisualTotals", "When", "Where", "With", "WTD", "Xor")); + "VisualTotals", "When", "Where", "With", "WTD", "Xor"); CatalogCache getCatalogCache(); /** diff --git a/api/src/main/java/org/eclipse/daanse/olap/api/calc/ResultStyle.java b/api/src/main/java/org/eclipse/daanse/olap/api/calc/ResultStyle.java index ca2ed38..be977dc 100644 --- a/api/src/main/java/org/eclipse/daanse/olap/api/calc/ResultStyle.java +++ b/api/src/main/java/org/eclipse/daanse/olap/api/calc/ResultStyle.java @@ -28,7 +28,6 @@ package org.eclipse.daanse.olap.api.calc; -import java.util.Arrays; import java.util.List; /** @@ -80,66 +79,41 @@ public enum ResultStyle { // collections of result styles. public static final List ANY_LIST = - Arrays.asList( - ANY); + List.of(ANY); public static final List ITERABLE_ONLY = - Arrays.asList( - ITERABLE); + List.of(ITERABLE); public static final List MUTABLELIST_ONLY = - Arrays.asList( - MUTABLE_LIST); + List.of(MUTABLE_LIST); public static final List LIST_ONLY = - Arrays.asList( - LIST); + List.of(LIST); public static final List ITERABLE_ANY = - Arrays.asList( - ITERABLE, - ANY); + List.of(ITERABLE, ANY); public static final List ITERABLE_LIST = - Arrays.asList( - ITERABLE, - LIST); + List.of(ITERABLE, LIST); public static final List ITERABLE_MUTABLELIST = - Arrays.asList( - ITERABLE, - MUTABLE_LIST); + List.of(ITERABLE, MUTABLE_LIST); public static final List ITERABLE_LIST_MUTABLELIST = - Arrays.asList( - ITERABLE, - LIST, - MUTABLE_LIST); + List.of(ITERABLE, LIST, MUTABLE_LIST); public static final List LIST_MUTABLELIST = - Arrays.asList( - LIST, - MUTABLE_LIST); + List.of(LIST, MUTABLE_LIST); public static final List MUTABLELIST_LIST = - Arrays.asList( - MUTABLE_LIST, - LIST); + List.of(MUTABLE_LIST, LIST); public static final List ITERABLE_LIST_MUTABLELIST_ANY = - Arrays.asList( - ITERABLE, - LIST, - MUTABLE_LIST, - ANY); + List.of(ITERABLE, LIST, MUTABLE_LIST, ANY); public static final List ITERABLE_MUTABLELIST_LIST = - Arrays.asList( - ITERABLE, - MUTABLE_LIST, - LIST); + List.of(ITERABLE, MUTABLE_LIST, LIST); public static final List ANY_ONLY = - Arrays.asList( - ANY); + List.of(ANY); } diff --git a/api/src/main/java/org/eclipse/daanse/olap/api/result/Property.java b/api/src/main/java/org/eclipse/daanse/olap/api/result/Property.java index f459b0c..3358489 100644 --- a/api/src/main/java/org/eclipse/daanse/olap/api/result/Property.java +++ b/api/src/main/java/org/eclipse/daanse/olap/api/result/Property.java @@ -33,8 +33,6 @@ package org.eclipse.daanse.olap.api.result; -import java.util.Collections; -import java.util.EnumSet; import java.util.Set; public interface Property { @@ -87,11 +85,9 @@ enum TypeFlag { private final int xmlaOrdinal; public static final Set CELL_TYPE_FLAG = - Collections.unmodifiableSet( - EnumSet.of(Property.TypeFlag.CELL)); + Set.of(Property.TypeFlag.CELL); public static final Set MEMBER_TYPE_FLAG = - Collections.unmodifiableSet( - EnumSet.of(Property.TypeFlag.MEMBER)); + Set.of(Property.TypeFlag.MEMBER); diff --git a/common/src/main/java/org/eclipse/daanse/olap/common/IdBatchResolver.java b/common/src/main/java/org/eclipse/daanse/olap/common/IdBatchResolver.java index 49ec665..a992d90 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/common/IdBatchResolver.java +++ b/common/src/main/java/org/eclipse/daanse/olap/common/IdBatchResolver.java @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -282,7 +281,7 @@ private List lookupChildrenByNames( } // don't want to fail at this point. Member resolution still has // another chance to succeed. - return Collections.emptyList(); + return List.of(); } /** diff --git a/common/src/main/java/org/eclipse/daanse/olap/common/StandardProperty.java b/common/src/main/java/org/eclipse/daanse/olap/common/StandardProperty.java index 9f39216..00085ff 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/common/StandardProperty.java +++ b/common/src/main/java/org/eclipse/daanse/olap/common/StandardProperty.java @@ -27,9 +27,7 @@ */ package org.eclipse.daanse.olap.common; -import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -451,8 +449,8 @@ private StandardProperty(String name, Datatype type, boolean internal, boolean m /** * The various property names which define a format string. */ - public static final Set FORMAT_PROPERTIES = new HashSet<>( - Arrays.asList("format", "format_string", "FORMAT", FORMAT_STRING.getName())); + public static final Set FORMAT_PROPERTIES = + Set.of("format", "format_string", "FORMAT", FORMAT_STRING.getName()); @Override public MemberPropertyFormatter getFormatter() { diff --git a/common/src/main/java/org/eclipse/daanse/olap/fun/MemberExtractingVisitor.java b/common/src/main/java/org/eclipse/daanse/olap/fun/MemberExtractingVisitor.java index f037c85..10a1783 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/fun/MemberExtractingVisitor.java +++ b/common/src/main/java/org/eclipse/daanse/olap/fun/MemberExtractingVisitor.java @@ -24,8 +24,6 @@ package org.eclipse.daanse.olap.fun; -import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -74,14 +72,11 @@ public class MemberExtractingVisitor extends MdxVisitorImpl { * one of these expressions would result in a set of members * that cannot be determined from the expression itself. */ - private static final String[] unsafeFuncNames = new String[] { + private static final List blacklist = List.of( "Ytd", "Mtd", "Qtd", "Wtd", "BottomCount", "TopCount", "ClosingPeriod", "Cousin", "FirstChild", "FirstSibling", "LastChild", "LastPeriods", "LastSibling", "ParallelPeriod", "PeriodsToDate", "Parent", - "PrevMember", "NextMember", "Ancestor", "Ancestors" - }; - private static final List blacklist = Collections.unmodifiableList( - Arrays.asList(MemberExtractingVisitor.unsafeFuncNames)); + "PrevMember", "NextMember", "Ancestor", "Ancestors"); public MemberExtractingVisitor( Set memberSet, ResolvedFunCall call, boolean mapToAllMember) diff --git a/common/src/main/java/org/eclipse/daanse/olap/fun/sort/TupleExpMemoComparator.java b/common/src/main/java/org/eclipse/daanse/olap/fun/sort/TupleExpMemoComparator.java index cf88694..489fbc4 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/fun/sort/TupleExpMemoComparator.java +++ b/common/src/main/java/org/eclipse/daanse/olap/fun/sort/TupleExpMemoComparator.java @@ -33,7 +33,6 @@ import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import org.eclipse.daanse.olap.api.Evaluator; import org.eclipse.daanse.olap.api.calc.Calc; @@ -85,7 +84,7 @@ private List dependentMembers( List tuple ) { getDependentHierarchiesIndices( tuple ); return Arrays.stream( dependentHierarchiesIndices ) .mapToObj( tuple::get ) - .collect( Collectors.toList() ); + .toList(); } private void getDependentHierarchiesIndices( List tuple ) { diff --git a/common/src/main/java/org/eclipse/daanse/olap/function/core/FunctionServiceImpl.java b/common/src/main/java/org/eclipse/daanse/olap/function/core/FunctionServiceImpl.java index e057663..6339595 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/function/core/FunctionServiceImpl.java +++ b/common/src/main/java/org/eclipse/daanse/olap/function/core/FunctionServiceImpl.java @@ -153,7 +153,7 @@ public List getResolvers(OperationAtom operationAtom) { FunctionAtomCompareKey key = new FunctionAtomCompareKey(operationAtom); List matchingResolvers = mapNameToResolvers.get(key); if (matchingResolvers == null) { - matchingResolvers = Collections.emptyList(); + matchingResolvers = List.of(); } return matchingResolvers; } diff --git a/common/src/main/java/org/eclipse/daanse/olap/function/def/descendants/DescendantsCalc.java b/common/src/main/java/org/eclipse/daanse/olap/function/def/descendants/DescendantsCalc.java index 93ed7d0..be79087 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/function/def/descendants/DescendantsCalc.java +++ b/common/src/main/java/org/eclipse/daanse/olap/function/def/descendants/DescendantsCalc.java @@ -14,7 +14,6 @@ package org.eclipse.daanse.olap.function.def.descendants; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.CatalogReader; @@ -100,7 +99,7 @@ private void descendantsByLevel( // (a city). This is why we repeat the before/self/after logic for // each member. final int levelDepth = level.getDepth(); - List members = Collections.singletonList( ancestor ); + List members = List.of( ancestor ); // Each pass, "fertileMembers" has the same contents as "members", // except that we omit members whose children we are not interested // in. We allocate it once, and clear it each pass, to save a little diff --git a/common/src/main/java/org/eclipse/daanse/olap/function/def/lastperiods/LastPeriodsCalc.java b/common/src/main/java/org/eclipse/daanse/olap/function/def/lastperiods/LastPeriodsCalc.java index 3c5b7e1..5aefbce 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/function/def/lastperiods/LastPeriodsCalc.java +++ b/common/src/main/java/org/eclipse/daanse/olap/function/def/lastperiods/LastPeriodsCalc.java @@ -14,7 +14,6 @@ package org.eclipse.daanse.olap.function.def.lastperiods; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.Evaluator; @@ -54,7 +53,7 @@ public TupleList evaluateInternal(Evaluator evaluator) { private List lastPeriods(Member member, Evaluator evaluator, Integer indexValue) { // empty set if ((indexValue == 0) || member.isNull()) { - return Collections.emptyList(); + return List.of(); } List list = new ArrayList<>(); diff --git a/common/src/main/java/org/eclipse/daanse/olap/function/def/set/ascendants/AscendantsCalc.java b/common/src/main/java/org/eclipse/daanse/olap/function/def/set/ascendants/AscendantsCalc.java index 86c3751..b442854 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/function/def/set/ascendants/AscendantsCalc.java +++ b/common/src/main/java/org/eclipse/daanse/olap/function/def/set/ascendants/AscendantsCalc.java @@ -14,7 +14,6 @@ package org.eclipse.daanse.olap.function.def.set.ascendants; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.CatalogReader; @@ -40,7 +39,7 @@ public TupleList evaluateInternal(Evaluator evaluator) { private List ascendants(CatalogReader schemaReader, Member member) { if (member.isNull()) { - return Collections.emptyList(); + return List.of(); } final List result = new ArrayList<>(); result.add(member); diff --git a/common/src/main/java/org/eclipse/daanse/olap/function/def/set/siblings/SiblingsCalc.java b/common/src/main/java/org/eclipse/daanse/olap/function/def/set/siblings/SiblingsCalc.java index c315b71..d1c433d 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/function/def/set/siblings/SiblingsCalc.java +++ b/common/src/main/java/org/eclipse/daanse/olap/function/def/set/siblings/SiblingsCalc.java @@ -13,7 +13,6 @@ */ package org.eclipse.daanse.olap.function.def.set.siblings; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.CatalogReader; @@ -40,7 +39,7 @@ public TupleList evaluateInternal(Evaluator evaluator) { private List memberSiblings(Member member, Evaluator evaluator) { if (member.isNull()) { // the null member has no siblings -- not even itself - return Collections.emptyList(); + return List.of(); } Member parent = member.getParentMember(); final CatalogReader schemaReader = evaluator.getCatalogReader(); diff --git a/common/src/main/java/org/eclipse/daanse/olap/impl/CellSetAxisMetaDataImpl.java b/common/src/main/java/org/eclipse/daanse/olap/impl/CellSetAxisMetaDataImpl.java index 86016b4..66a11ac 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/impl/CellSetAxisMetaDataImpl.java +++ b/common/src/main/java/org/eclipse/daanse/olap/impl/CellSetAxisMetaDataImpl.java @@ -14,7 +14,6 @@ package org.eclipse.daanse.olap.impl; import java.util.ArrayList; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -113,7 +112,7 @@ public List getProperties() { private List getHierarchiesNonFilter() { final Expression exp = queryAxis.getSet(); if (exp == null) { - return Collections.emptyList(); + return List.of(); } List hierarchyList = new ArrayList<>(); hierarchyList.addAll(TypeUtil.getHierarchies(exp.getType())); diff --git a/common/src/main/java/org/eclipse/daanse/olap/query/component/DrillThroughImpl.java b/common/src/main/java/org/eclipse/daanse/olap/query/component/DrillThroughImpl.java index f9c1e83..0c7acc9 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/query/component/DrillThroughImpl.java +++ b/common/src/main/java/org/eclipse/daanse/olap/query/component/DrillThroughImpl.java @@ -27,7 +27,6 @@ import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.CatalogReader; @@ -68,7 +67,7 @@ public DrillThroughImpl( this.query = query; this.maxRowCount = maxRowCount; this.firstRowOrdinal = firstRowOrdinal; - this.returnList = Collections.unmodifiableList( + this.returnList = List.copyOf( resolveReturnList(returnList)); } @@ -118,7 +117,7 @@ public List getReturnList() { private List resolveReturnList(List returnList) { if (returnList == null) { - return Collections.emptyList(); + return List.of(); } List returnClauseElements = new ArrayList<>(); CatalogReader reader = query.getCatalogReader(true); diff --git a/common/src/main/java/org/eclipse/daanse/olap/query/component/IdImpl.java b/common/src/main/java/org/eclipse/daanse/olap/query/component/IdImpl.java index 404fd72..3f0fb59 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/query/component/IdImpl.java +++ b/common/src/main/java/org/eclipse/daanse/olap/query/component/IdImpl.java @@ -30,7 +30,6 @@ import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.DataType; @@ -65,7 +64,7 @@ public class IdImpl * @param segment Segment, consisting of a name and quoting style */ public IdImpl(Segment segment) { - segments = Collections.singletonList(segment); + segments = List.of(segment); } public IdImpl(List segments) { @@ -111,7 +110,7 @@ public String[] toStringArray() { @Override public List getSegments() { - return Collections.unmodifiableList(this.segments); + return List.copyOf(this.segments); } @Override diff --git a/common/src/main/java/org/eclipse/daanse/olap/util/Format.java b/common/src/main/java/org/eclipse/daanse/olap/util/Format.java index ece7133..3bb756d 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/util/Format.java +++ b/common/src/main/java/org/eclipse/daanse/olap/util/Format.java @@ -45,9 +45,7 @@ import java.text.FieldPosition; import java.text.NumberFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; @@ -1477,7 +1475,7 @@ private static Token nfe( public static List getTokenList() { - return Collections.unmodifiableList(Arrays.asList(tokens)); + return List.of(tokens); } /** diff --git a/common/src/main/java/org/eclipse/daanse/olap/util/IdentifierParser.java b/common/src/main/java/org/eclipse/daanse/olap/util/IdentifierParser.java index 069c2e3..1302382 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/util/IdentifierParser.java +++ b/common/src/main/java/org/eclipse/daanse/olap/util/IdentifierParser.java @@ -36,7 +36,6 @@ package org.eclipse.daanse.olap.util; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.olap.api.CatalogReader; @@ -193,7 +192,7 @@ public static class MemberListBuilder extends BuilderImpl { public MemberListBuilder( CatalogReader schemaReader, Cube cube, Hierarchy hierarchy) { - super(schemaReader, cube, Collections.singletonList(hierarchy)); + super(schemaReader, cube, List.of(hierarchy)); } @Override diff --git a/common/src/main/java/org/eclipse/daanse/olap/util/type/TypeUtil.java b/common/src/main/java/org/eclipse/daanse/olap/util/type/TypeUtil.java index 4fb6458..58eb5f1 100644 --- a/common/src/main/java/org/eclipse/daanse/olap/util/type/TypeUtil.java +++ b/common/src/main/java/org/eclipse/daanse/olap/util/type/TypeUtil.java @@ -30,7 +30,6 @@ package org.eclipse.daanse.olap.util.type; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.eclipse.daanse.mdx.model.api.expression.operation.BracesOperationAtom; @@ -615,7 +614,7 @@ public static List getHierarchies(Type type) { return hierarchyList; } else { Hierarchy hierarchy = type.getHierarchy(); - return hierarchy == null ? Collections.emptyList() : Collections.singletonList(hierarchy); + return hierarchy == null ? List.of() : List.of(hierarchy); } } diff --git a/xmla/bridge/src/main/java/org/eclipse/daanse/olap/xmla/bridge/execute/Convertor.java b/xmla/bridge/src/main/java/org/eclipse/daanse/olap/xmla/bridge/execute/Convertor.java index 5d27125..1e646c1 100644 --- a/xmla/bridge/src/main/java/org/eclipse/daanse/olap/xmla/bridge/execute/Convertor.java +++ b/xmla/bridge/src/main/java/org/eclipse/daanse/olap/xmla/bridge/execute/Convertor.java @@ -29,7 +29,6 @@ import java.time.Instant; import java.util.AbstractList; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -138,7 +137,7 @@ public class Convertor { cellPropertyMap.put("FONT_FLAGS", new CellProperty("FONT_FLAGS", "FontFlags", "xsd:int")); } - protected static final List defaultProps = Arrays.asList( + protected static final List defaultProps = List.of( rename(Property.StandardMemberProperty.MEMBER_UNIQUE_NAME, "UName"), rename(Property.StandardMemberProperty.MEMBER_CAPTION, "Caption"), rename(Property.StandardMemberProperty.LEVEL_UNIQUE_NAME, "LName"), @@ -406,7 +405,7 @@ private static List getSlicerAxisHierarchies(CellSet cellSet, boolean // The slicer axes contains the default hierarchy // of each dimension not seen on another axis. List unseenDimensionList = new ArrayList( - cube.getDimensions() != null ? Arrays.asList(cube.getDimensions()) : List.of()); + cube.getDimensions() != null ? List.of(cube.getDimensions()) : List.of()); for (Hierarchy hier1 : axisHierarchyList) { unseenDimensionList.remove(hier1.getDimension()); } @@ -886,7 +885,7 @@ private static AxesInfoR getAxesInfo(CellSet cellSet, Cube cube, boolean omitDef // The slicer axes contains the default hierarchy // of each dimension not seen on another axis. List unseenDimensionList = new ArrayList( - cube.getDimensions() != null ? Arrays.asList(cube.getDimensions()) : List.of()); + cube.getDimensions() != null ? List.of(cube.getDimensions()) : List.of()); for (Hierarchy hier1 : axisHierarchyList) { unseenDimensionList.remove(hier1.getDimension()); }