You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by zh...@apache.org on 2022/11/26 06:43:10 UTC

[incubator-hugegraph-computer] branch improve_list_value created (now ced97a56)

This is an automated email from the ASF dual-hosted git repository.

zhaocong pushed a change to branch improve_list_value
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git


      at ced97a56 improve ListValue

This branch includes the following new commits:

     new ced97a56 improve ListValue

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-hugegraph-computer] 01/01: improve ListValue

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zhaocong pushed a commit to branch improve_list_value
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git

commit ced97a560ee59c10bc35ca906173de78553d875c
Author: coderzc <zh...@apache.org>
AuthorDate: Sat Nov 26 14:42:43 2022 +0800

    improve ListValue
---
 .../hugegraph/computer/core/graph/value/ListValue.java     | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/computer-api/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java b/computer-api/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java
index 1b78dc74..73b641fb 100644
--- a/computer-api/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java
+++ b/computer-api/src/main/java/com/baidu/hugegraph/computer/core/graph/value/ListValue.java
@@ -29,6 +29,7 @@ import java.util.NoSuchElementException;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.ListUtils;
+import org.apache.hugegraph.util.E;
 
 import com.baidu.hugegraph.computer.core.common.ComputerContext;
 import com.baidu.hugegraph.computer.core.common.SerialEnum;
@@ -36,9 +37,8 @@ import com.baidu.hugegraph.computer.core.graph.GraphFactory;
 import com.baidu.hugegraph.computer.core.graph.value.Value.Tvalue;
 import com.baidu.hugegraph.computer.core.io.RandomAccessInput;
 import com.baidu.hugegraph.computer.core.io.RandomAccessOutput;
-import org.apache.hugegraph.util.E;
 
-public class ListValue<T extends Tvalue<?>> implements Tvalue<List<Object>> {
+public class ListValue<T extends Tvalue<?>> implements Tvalue<List<T>> {
 
     private final GraphFactory graphFactory;
     private ValueType elemType;
@@ -106,7 +106,7 @@ public class ListValue<T extends Tvalue<?>> implements Tvalue<List<Object>> {
     }
 
     public List<T> values() {
-        return Collections.unmodifiableList(this.values);
+        return value();
     }
 
     public int size() {
@@ -114,12 +114,8 @@ public class ListValue<T extends Tvalue<?>> implements Tvalue<List<Object>> {
     }
 
     @Override
-    public List<Object> value() {
-        List<Object> list = new ArrayList<>(this.values.size());
-        for (T value : this.values) {
-            list.add(value.value());
-        }
-        return list;
+    public List<T> value() {
+        return Collections.unmodifiableList(this.values);
     }
 
     @Override