1
 /**
     * @return Returns the parameters.
     */
    public Set<FeatureParameterDTO> getParameters() {
        return this.parameters;
    }

how can i get value from getParameters? toString is not ok? What is correct way?

4

2 回答 2

5

You possibly have multiple values. So you'd have to iterate over them. You should be more precise with your questions. This one is quite vage. Just a quick example:

import java.util.Set;
import java.util.TreeSet;


public class SetTest {

Set<Integer> parameters = new TreeSet<Integer>();

  public static void main(String[] args) {
      SetTest st = new SetTest();
      Set<Integer> param = st.getParameters();
      param.add(1);
      param.add(2);
      param.add(3);

      for (Integer myVal : param) {
        System.out.println(myVal);
      }
   }

   public Set<Integer> getParameters() {
      return this.parameters;
   }
}
于 2012-12-11T13:43:40.833 回答
3

You can iterate over the return value of getParameters(), like this:

for (FeatureParameterDTO fpt : getParameters()) {
  // do what you want with fpt
}
于 2012-12-11T13:24:00.270 回答