Chung-En Lee created HDDS-16201:
-----------------------------------
Summary: Rename getLocationList to createLocationList
Key: HDDS-16201
URL: https://issues.apache.org/jira/browse/HDDS-16201
Project: Apache Ozone
Issue Type: Improvement
Reporter: Chung-En Lee
h4. *Problem*
The current implementation of {{getLocationList()}} dynamically creates and
allocates a new {{List}} on every call by streaming and flattening
{{{}locationVersionMap{}}}:
Java
/**
* Use this expensive method only when absolutely needed!
* It creates a new list so it is not an O(1) operation.
* Use getLocationLists() instead.
* @return a list of OmKeyLocationInfo
*/
public List<OmKeyLocationInfo> getLocationList() \{
return locationVersionMap.values().stream().flatMap(List::stream)
.collect(Collectors.toList());
}
Rename `{{{}getLocationList()`{}}} to `{{{}createLocationList()`{}}} to
explicitly convey that a new collection is instantiated and returned on each
invocation, preventing developers from misusing it as a lightweight/O(1) getter.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]