I have a Set instance:
Set<String> siteIdSet = (Set<String>) pContext.getParent().getPropertyValue(getCatalogProperties().getSitesPropertyName());
The pContext.getParent().getPropertyValue() is out-of-the-box code upon which I don't have any control to modify.
Requirement:
I wanted to get the first default element out of it (always). However, I couldn't find a method get(index) like in an ArrayList.
Hence, right now, I am doing like this.
for (Iterator<String> it = siteIdSet.iterator(); it.hasNext();) {
siteId = it.next();
break;
}
Is there any (other) efficient way (short and better) of achieving this?