1
我想獲得所有ClassNode
字段的一定條件。 在我的代碼,它看起來是這樣的:簡化代碼中的`grep`設施
listener.classNode.fields.grep {
!it.name.startsWith('$') &&
!it.name.startsWith('_') &&
!it.name.equals('metaClass') &&
!it.name.startsWith('this')
}.collect{ it.name }
有沒有一種方法,使其更好?我的意思是擺脫grep
區塊內的那些條件陳述?
我的目標只是我能理解的幻想代碼,所以人類readab我不打擾我。 – lapots