How to get methods list in scala
        Posted  
        
            by skyde
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by skyde
        
        
        
        Published on 2010-05-22T00:37:56Z
        Indexed on 
            2010/05/22
            0:40 UTC
        
        
        Read the original article
        Hit count: 332
        
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
“”.methods.sort.grep /index/i
And in java
List results = new ArrayList();  
Method[] methods = String.class.getMethods();  
for (int i = 0; i < 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;  
How would you do the same thing in Scala?
© Stack Overflow or respective owner