DomGarguilo commented on a change in pull request #2535:
URL: https://github.com/apache/accumulo/pull/2535#discussion_r818875962



##########
File path: 
core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigDecimalLexicoderTest.java
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.lexicoder;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.accumulo.core.clientImpl.lexicoder.AbstractLexicoderTest;
+import org.junit.jupiter.api.Test;
+
+public class BigDecimalLexicoderTest extends AbstractLexicoderTest {
+
+  @Test
+  public void testSortOrder() {
+
+    List<BigDecimal> list =
+        List.of("2.0", "2.00", "2.000", "-3.000", "-2.00", "0.0000", "0.1", 
"0.10", "-65537.000",
+            "-65537.00", 
"-65537.0").stream().map(BigDecimal::new).collect(Collectors.toList());

Review comment:
       Looks like this could be simplified even more by using `Stream.of()`. 
The suggested code should be formatted correctly but changed the imports I 
think so might fail the checks until they are updated.
   ```suggestion
       var list = Stream.of("2.0", "2.00", "2.000", "-3.000", "-2.00", 
"0.0000", "0.1", "0.10",
           "-65537.000", "-65537.00", 
"-65537.0").map(BigDecimal::new).collect(Collectors.toList());
   ```
   I changed to `var` here because keeping it as list messed with the 
formatting making for some less readable code:
   ```Java
       List<
           BigDecimal> list =
               Stream
                   .of("2.0", "2.00", "2.000", "-3.000", "-2.00", "0.0000", 
"0.1", "0.10",
                       "-65537.000", "-65537.00", "-65537.0")
                   .map(BigDecimal::new).collect(Collectors.toList());
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to