How to obtain first 5 values from a LinkedHashSet?
<p>I have a LinkedHashSet which contains multiple number of values. </p>

<pre><code>LinkedHashSet&lt;String&gt; lhs = new LinkedHashSet&lt;String&gt;();
</code></pre>

<p>I want to iterate through the set of values and display the first five values from the number of items stored in the set. I have used a for loop to iterate through values and display data, see below:</p>

<pre><code>for (String sent : lhs) {        
    text.append(sent);                                          
}
</code></pre>

<p>This outputs all the values stored in the LinkedHashSet. What alterations should I make to my code in order to only get the first 5 values from the set. </p>