摘要:equals vs == equals : always remember to override hashCode if you override equals so as not to "break the contract". if equals. the hashCode must be same.== : it returns true if both variables refer to the same object, if their references are one and the same.why in the abstract class, can
阅读全文
摘要:Thread safety A piece of code is thread-safe if it only manipulates shared data structures in a manner that guarantees safe execution by multiple threads at the same time. #include int increment_counter (){ static int counter = 0; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZ...
阅读全文
摘要:rope (data structure) + KMP(string search) O(m+n)
阅读全文
摘要:局部内部类为什么只能访问final局部变量?分类:Java2012-01-07 14:03874人阅读评论(1)收藏举报stringthreadclassjava[html]view plaincopy//只有定义成finalStringobj才不会报错publicvoidtest(finalStringobj){ThreadmyThread=newThread(){publicvoidrun(){System.out.println(obj);}};myThread.start();}[html]view plaincopypublicclassOuterClass{publicvoidou
阅读全文