private long [ ] getUsersListMembers ( String [ ] tUserlists ) { logger . debug ( "Fetching user id of given lists" ) ; List < Long > listUserIdToFollow = new ArrayList < Long > ( ) ; Configuration cb = buildTwitterConfiguration ( ) ; Twitter twitterImpl = new TwitterFactory ( cb ) . getInstance ( ) ; //For each list given in parameter for ( String listId : tUserlists ) { logger . debug ( "Adding users of list {} " , listId ) ; String [ ] splitListId = listId . split ( "/" ) ; try { long cursor = - 1 ; PagableResponseList < User > itUserListMembers ; do { itUserListMembers = twitterImpl . getUserListMembers ( splitListId [ 0 ] , splitListId [ 1 ] , cursor ) ; for ( User member : itUserListMembers ) { long userId = member . getId ( ) ; listUserIdToFollow . add ( userId ) ; } } while ( ( cursor = itUserListMembers . getNextCursor ( ) ) != 0 ) ; } catch ( TwitterException te ) { logger . error ( "Failed to get list members for : {}" , listId , te ) ; } } //Just casting from Long to long long ret [ ] = new long [ listUserIdToFollow . size ( ) ] ; int pos = 0 ; for ( Long userId : listUserIdToFollow ) { ret [ pos ] = userId ; pos ++ ; } return ret ; }
Get users id of each list to stream them .