From my August 2004 email:
I've been having a quick look at the Groovy JDK, i.e. DefaultGroovyMethods
and DefaultGroovyStaticMethods
As there are so many methods in these classes, it can be a little hard to
take in all at once. So I've knocked up a quick script (in groovy),
that collates
the methods against the objects to which they become attached.
hacky script -> http://javanicus.com/groovy/MungGroovySourceCode.groovy
The result is a pretty table, with the methods down the left hand side,
and the Classes to which they are attached along the top. Where a method
has been implemented, at the crossover, I have placed a small graphic,
which if you hover your cursor over, will give you a bit more detail
about the method.
http://javanicus.com/groovy/GroovyJDKCrossReference.html
I've had a quick look for methods that I thought would be defined and
from my quick inspection of abs() thru to leftShift() so far, I believe
that the following candidates are available
(this is by no means an exhaustive list...)
- Some possible missing (non static) methods
Collection.asImmutable()
Object.asImmutable()
Object.asSynchronized()
Set.count()
Byte[].eachByte()
File.filterLine()
InputStream.filterLine()
List.findIndexOf()
Collection.flatten()
Date.getAt() // to get the year etc... (In conjunction with a Calendar?)
Reader.getText()
Collection.intersect()
BufferedWriter <<
Object[] <<
CharSequence <<
File <<
Map << // another Map
Process << // to the process.out
Socket << // to the socket.out
Object[].max()
Object[].min()
Collection.minus()
Map.minus() // could compare RHS with key || value
Object[].minus()
URL.newInputStream()
URL.newReader()
CharSequence.padLeft()
CharSequence.padRight()
Object[].pop()
CharSequence.putAt()
Collection.putAt() // !always ordered, but we have
Collection.getAt()
Date.putAt() // e.g. easy acces to day component of date
Matcher.putAt()
InputStream.readBytes()
URL.readBytes()
URL.readLines()
CharSequence.reverse()
Object[].reverse()
SortedMap.reverse()
SortedSet.reverse()
Collection.reverseEach() // like Collection.each() this could be indeterminate...
Map.reverseEach() // we have Map.each()...
Matcher.reverseEach()
Object.reverseEach()
Object[].reverseEach() // perhaps foo.reverseEach() should be foo.reverse().each()
Object.rightShift() // so you can do things like... foo >> log
Object[].sort()
InputStream.splitEachLine()
URL.splitEachLine()
OutputStream.withWriterAppend()
BufferedWriter.write()
OutputStream.write()
File.writeLine()
OutputStream.writeLine()
- and I'm not quite sure what the difference between append() and << is
supposed to be, perhaps File.append() will become File <<
- As we have eachByte(), would it not be a good idea to also have eachCharacter() for the Readers...
thanks
Jeremy.
P.S. This is based entirely on existing methods and existing Owner Objects,
would be nice to think of what other Objects and methods we could include,
(current owner objects come from java.lang., java.util.,
java.util.regex., java.io. and java.net.*)