hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manoj Govindassamy (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-12653) Implement toArray() and subArray() for ReadOnlyList
Date Fri, 20 Oct 2017 23:52:00 GMT

     [ https://issues.apache.org/jira/browse/HDFS-12653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Manoj Govindassamy updated HDFS-12653:
    Attachment: HDFS-12653.01.patch

Attached v01 patch to address the following
1. Implemented {{ReadOnlyList#toArray()}} and {{ReadOnlyList#subArray()}} to return an array
view of the backing list
2. TestReadOnly - unit tests to verify various contracts in ReadOnlyList. 
ReadOnly#toArray() and ReadOnlyList#subArray() can be made use when getting attributes from
INodeAttributesProvider (HDFS-12652) and when working on the children list for a snapshot.
Will follow on these after completing this jira.
[~eddyxu], [~yzhangal], [~daryn], can you please take a look at the patch. 

> Implement toArray() and subArray() 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
>         Attachments: HDFS-12653.01.patch
> {{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

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

View raw message