lilu created CURATOR-651:
----------------------------
Summary: Why use Collection instead of List as return value
Key: CURATOR-651
URL: https://issues.apache.org/jira/browse/CURATOR-651
Project: Apache Curator
Issue Type: Bug
Reporter: lilu
Assignee: Jordan Zimmerman
org.apache.curator.x.discovery.ServiceDiscovery#queryForInstances
The implementation class internally calls
org.apache.curator.x.discovery.details.ServiceDiscoveryImpl#queryForInstances(java.lang.String,
org.apache.zookeeper.Watcher)
The specific code is:
{code:java}
@Override
public Collection<ServiceInstance<T>> queryForInstances(String name) throws
Exception
{
return queryForInstances(name, null);
}
List<ServiceInstance<T>> queryForInstances(String name, Watcher watcher) throws
Exception
{
// ...
}{code}
Why is List implicitly converted to Collection?
This way I won't be able to use List.get(0) directly. but requires a conversion.
May I ask what is the reason for doing this?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)