Created
November 6, 2010 21:39
-
-
Save sberan/665726 to your computer and use it in GitHub Desktop.
Top 20 interfaces with the most methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
import java.util.jar.JarFile; | |
sys_jar_loc = "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar" | |
interfaces = JarFile.new(sys_jar_loc).entries.map do |entry| | |
if entry.name.match /java.*\.class$/ and not entry.name.match(/\$/) | |
begin | |
clas = java.lang.Class.forName(entry.name.gsub(/\.class$/,'').gsub(/\//,'.')) | |
clas.isInterface ? clas : nil | |
rescue | |
nil | |
end | |
end | |
end | |
interfaces.compact.sort_by{|c| -c.methods.size}.take(20).each_with_index do |c, i| | |
puts "#{i+1}. #{c.name} - #{c.methods.size} methods" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment