Example usage for twitter4j Friendship isFollowing

List of usage examples for twitter4j Friendship isFollowing

Introduction

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

Prototype

boolean isFollowing();

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 {/*www.j  a  v  a 2s.c  o  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//from  www  . j a  va  2s . c o m
 */
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);
    }
}