android如何提升性能技巧(上)

网友投稿 592 2022-05-29

Map myMap1 = new HashMap();

HashMap myMap2 = new HashMap();

for (int i = 0; i< this.mCount; i++)

dumpItem(this.mItems[i]);

最好改成这样:

int count = this.mCount;

Item[] items = this.mItems;

for (int i = 0; i< count; i++) dumpItems(items[i]);

static int intVal = 42;

static String strVal = “Hello, world!”;

static final int intVal = 42;

static final String strVal = “Hello, world!”;

public class Foo {

private int mValue;

public void run() {

Inner in = new Inner();

mValue = 27;

in.stuff();

android如何提升性能技巧(上)

}

private class Inner {

void stuff() {

System.out.println(Foo.this.mValue);

}

}

}

Foo$Inner是一个完全独立的类,它要直接访问Foo的私有成员是非法的。编译器会自动生成一个方法:

static int Foo.access$100(Foo foo) {

return foo.mValue;

}

Android API

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:OpenCV C++简单的视频读取和保存入门
下一篇:【HTML + CSS】模仿腾讯云页面——初步实现
相关文章