title: Getting the value of an object that is a collection
body: <p>I am using a method that returns an Object when called. That object's type is java.util.Collections.unmodifiableSet . The collection holds only one value, that I need to access and feed to another method. The problem is that doing this:</p>
  
  <pre><code>Object o = table.getValue().toString();
  </code></pre>
  
  <p>returns the value surrounded in [ ] since it is a Collection. The other method needs to be called with Object type parameter, that should be only the value without the [ ]. I have got the thing working by removing the square brackets with regular expression, but would like to get the thing working by somehow casting the collection to an appropriate type.</p>