Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How were you proposing to retrieve the item from the hash set? A set is by definition not ordered in any way and therefore, there is no index with which to use to retrieve the object in question.</p> <p>Sets, as a concept, are used to test inclusion, i.e. whether or not the element in question is in the hash data set. If you're looking to retrieve a value from a data source using a key value or index, I would suggest looking into either a <a href="http://java.sun.com/javase/6/docs/api/java/util/Map.html" rel="noreferrer">Map</a> or a <a href="http://java.sun.com/javase/6/docs/api/java/util/List.html" rel="noreferrer">List</a>.</p> <p><strong>EDIT: Additional answer based on the Edit to the original question</strong></p> <p>Soonil, based on your new information, it looks like you might be interested in implementing your data as a Java Enum, something similar to this:</p> <pre><code> public enum SoonilsDataType { A, B, C; // Just an example of what's possible public static SoonilsDataType getCompositeValue(SoonilsDataType item1, SoonilsDataType item2) { if (item1.equals(A) &amp;&amp; item2.equals(B)) { return C; } } } </code></pre> <p>Enum's automatically inherit values() which returns the list of all values in the enum's "set", which you can use to test inclusion against in the same way as the Set. Also, because its a full class, you can define new static methods to do the composite logic (like I was trying to allude to in the example code). The only thing about the Enum is that you can't add new instances at runtime, which may not be what you want (though if the set's data size isn't going to grow at runtime, the Enum is what you want).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload