Trong MMORoomGroupTest em thấy a có dùng EzyWrap. Sao phải dùng nó và khi nào nên dùng nó ạ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. EzyWrap cũng giống AtomicReference nó chuyên dùng để wrap lại giá trị thực tế ở bên trong.
2. Khi nào dùng nó?
Ví dụ trong trường hợp này:
Nó sẽ báo lỗi
Local variable roomGroupThreadName defined in an enclosing scope must be final or effectively final
, vì bản chất cái code này nó tương đương với:Mà biến final thì không thể gán được. Tuy không thể gán được nhưng vẫn có thể gọi hàm được nên mình sẽ sử dụng EzyWrap em ạ
Một trường hợp nữa em có thể sử dụng đó là lấy output của hàm, trong trường hợp em không muốn sử dụng return.