收集

Android Guide、SourceCode collection

1.比较对象是否相同

1 /** Checks whether two providers are the same */

2 private boolean isSameProvider(String provider1, String provider2) {

3     if (provider1 == null) {

4       return provider2 == null;

5     }

6     return provider1.equals(provider2);

7 }
Check equal

 2.新的消息加入到消息队列时,根据它的处理时间找到合适的位置

Message prev = null;

while (p != null && p.when <= when) {

prev = p;

p = p.next;

}

msg.next = prev.next;

prev.next = msg;

needWake = false; // still waiting on head, no need to wake up
View Code

 

你可能感兴趣的:(收集)