不再有丑陋的匿名内部类:只要通过这些便捷方法使用闭包就可以!
No more ugly anonymous inner classes: just use closures through those shortcut methods!
内部类的事件处理方法如清单2 所示。
The event handling method of the inner class is shown in Listing 2.
新的内部类可以帮助我们了解下列两对新方法,并有助于我们在Thread中使用它们。
This new inner class helps us to understand and use the following two pairs of new methods in thread.
内部类会在外部类中任何需要访问mValue字段或调用doStuff方法的地方调用这些静态方法。
The inner class code calls these static methods whenever it needs to access the mValue field or invoke the doStuff method in the outer class.
默认情况下,它将进行递归调用。因此,您也可以在任何一个内部类中发现方法声明。
This one makes recursive calls by default; therefore, it will also find method declarations in any inner classes.
您还可以利用类长度、方法长度和内部类耦合。
You can also look out for class length, method length, and intra-class coupling.
使用针对类长度、方法长度和内部类耦合的复杂性度量(即对象导入和惟一类型)是理解您所面临的困难的第一步。
Using complexity metrics for class length, method length, and intra-class coupling (that is, object imports and unique types) is the first step toward understanding what you're up against.
每个内部类都有一个能够添加适用于该类的关系和访问器(getter)来访问其在内部管理的关系的方法。
Each of the inner classes has a method to add a relationship appropriate to its class, and accessors (getters) to access the relationships it manages internally.
有时需要编写一个子类(通常作为内部类)来测试protected 的方法。
Sometimes you need to write a subclass (often as an inner class) in order to test protected methods.
addOrderFrom()方法成为公共类的匿名内部类创建的定义,将这两个工作项目包装起来。
The addOrderFrom() method collapses to the definition of an anonymous inner class creation of the command class, wrapping the two work items.
考虑到包装这个方法的匿名内部类的真正用途,我留下了几行难看的样板代码—addorderfrom方法体中的两行代码。
I'm left with some ugly boilerplate code because of the anonymous inner class wrapping this method's real purpose - the two lines of code that appear in the body of the addOrderFrom method.
Scala是静态类型的,这就允许它提供泛型类、内部类、甚至多态方法(Polymorphic Method)。
Scala is statically typed which allows it to provide generic classes, inner classes and even polymorphic methods.
同时也增加了一些新特性:集成了控制台类库( io-consolegem),正则表达式中增加了对Unicode6的支持,以及新增了 一些内部类中的方法。
There are a small number of new features: a console library ( io-console gem) was integrated, Unicode 6 support for regular expressions, and a bunch of new methods for the builtin classes.
编译器完全禁止在静态方法和静态内部类中引用封闭类型参数。
Referring to enclosing type parameters inside static methods and static inner classes is prohibited outright by the compiler. So, for instance, the following code is illegal in tiger.
在限制类型的范畴上,创建内部类是一种经常被忽略的方法。
Creating internal classes is an often overlooked method of limiting the scope of types.
接口中的内部类中不应该有公共的或者默认的构造方法。
Utility classes should not have a public or default constructor.
接口中的内部类中不应该有公共的或者默认的构造方法。
Utility classes should not have a public or default constructor.
应用推荐