49. System.out.println(\); 50. while(it22.hasNext()){ 51. System.out.print(it22.next()+\); //1 3 52. } 53. 54. Iterator
Java代码 1. 2. 3. 4. 5. 6. 7. 8. 9. package com.redis.test; import java.util.Iterator; public class IsFollowTestMain { //简单测试、没有采用单元测试Junit public static void main(String[] args) { UserService user1 = new UserServiceImpl(\); 10. UserService user2 = new UserServiceImpl(\); 11. UserService user3 = new UserServiceImpl(\); 12. user1.follow(\); 13. 14. user2.follow(\); 15. user2.follow(\); 16. 17. user3.follow(\); 18. user3.follow(\); 19. 20. boolean isfollowing = user1.isfollowing(\); 21. System.out.println(\+isfollowing); //true 22. 23. boolean isfollowed = user1.isfollowedBy(\); 24. System.out.println(\+isfollowed); //true 25. 26. Long followingCount = user1.followingCount(); 27. System.out.println(\+followingCount); //1 28. 29. Long followedCount = user2.followerCount(); 30. System.out.println(\+followedCount); //2 31. 32. Iterator