title: How to get methods list in scala
body: <p>In language like python and ruby to ask the language what index-related methods its string class supports (which methods’ names contain the word “index”)  you can do  </p>
  
  <pre><code>“”.methods.sort.grep /index/i
  </code></pre>
  
  <p>And in java</p>
  
  <pre><code>List results = new ArrayList();  
  Method[] methods = String.class.getMethods();  
  for (int i = 0; i &lt; methods.length; i++) {  
      Method m = methods[i];  
      if (m.getName().toLowerCase().indexOf(“index”) != -1) {  
          results.add(m.getName());  
      }  
  }  
  String[] names = (String[]) results.toArray();  
  Arrays.sort(names);  
  return names;  
  </code></pre>
  
  <p>How would you do the same thing in Scala?</p>