Example usage for twitter4j Friendship isFollowedBy

List of usage examples for twitter4j Friendship isFollowedBy

Introduction

In this page you can find the example usage for twitter4j Friendship isFollowedBy.

Prototype

boolean isFollowedBy();

Source Link

Usage

From source file:com.SocialAccess.TwitterSearch.java

public static void ShowFriendsListNames() {
    List<String[]> data = CSVutil.readCSV(Constants.CSV_FILE_NAME);
    String[] people = data.get(0);
    try {/*from   w  ww .  j a  v a 2s  . co m*/
        Twitter twitter = new TwitterFactory().getInstance();
        ResponseList<Friendship> friendships = twitter.lookupFriendships(people);
        for (Friendship friendship : friendships) {
            System.out.println("@" + friendship.getScreenName() + " following: " + friendship.isFollowing()
                    + " followed_by: " + friendship.isFollowedBy());
        }
        System.out.println("Successfully looked up friendships [" + people[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to lookup friendships: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.friendship.LookupFriendships.java

License:Apache License

/**
 * Usage: java twitter4j.examples.user.LookupFriendships [screen name[,screen name..]]
 *
 * @param args message// w  ww.  ja va 2  s  .  c  om
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out
                .println("Usage: java twitter4j.examples.user.LookupFriendships [screen name[,screen name..]]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        ResponseList<Friendship> friendships = twitter.lookupFriendships(args[0].split(","));
        for (Friendship friendship : friendships) {
            System.out.println("@" + friendship.getScreenName() + " following: " + friendship.isFollowing()
                    + " followed_by: " + friendship.isFollowedBy());
        }
        System.out.println("Successfully looked up friendships [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to lookup friendships: " + te.getMessage());
        System.exit(-1);
    }
}