2010-08-11

naming ...

最长的不是最搞的,还有蛋疼的。
果然是编程两大学问之一。

=====8<=====8<=====8<=====8<=====8<=====8<=====8<=====

最长的
org.aspectj.weaver.patterns.HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor

最搞的
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState

蛋疼的
@Test
public void smthjavaJoke() {
    //找到classpath中,类名最长的类  o(╯□╰)o

    ClassPathScaner scaner = new ClassPathScaner();
    scaner.addIncludeFilter(new AssignableTypeFilter(Object.class));
    Set<MetadataReader> all = scaner.findCandidateClasss(true, "org");
    TopCountMap<String> res = new TopCountMap<String>(3);

    for (MetadataReader reader : all) {
        String name = reader.getClassMetadata().getClassName();
        if (name.indexOf('$') > 0)
            continue;
        res.add(name, name.length());
    }
    System.out.println(res);
}

No comments:

Post a Comment