You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Manoj Govindassamy (JIRA)" <ji...@apache.org> on 2017/10/13 00:13:00 UTC

[jira] [Created] (HDFS-12653) Implement toArray() and toSubArray() for ReadOnlyList

Manoj Govindassamy created HDFS-12653:
-----------------------------------------

             Summary: Implement toArray() and toSubArray() for ReadOnlyList
                 Key: HDFS-12653
                 URL: https://issues.apache.org/jira/browse/HDFS-12653
             Project: Hadoop HDFS
          Issue Type: Improvement
            Reporter: Manoj Govindassamy
            Assignee: Manoj Govindassamy


{{ReadOnlyList}} today gives an unmodifiable view of the backing List. This list supports following Util methods for easy construction of read only views of any given list. 

{noformat}
public static <E> ReadOnlyList<E> asReadOnlyList(final List<E> list) 

public static <E> List<E> asList(final ReadOnlyList<E> list)
{noformat}

{{asList}} above additionally overrides {{Object[] toArray()}} of the {{java.util.List}} interface. Unlike the {{java.util.List}}, the above one returns an array of Objects referring to the backing list and avoid any copying of objects. Given that we have many usages of read only lists,

1. Lets have a light-weight / shared-view {{toArray()}} implementation for {{ReadOnlyList}} as well. 
2. Additionally, similar to {{java.util.List#subList(fromIndex, toIndex)}}, lets have {{ReadOnlyList#subArray(fromIndex, toIndex)}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org