gpt4 book ai didi

java - Twitter4j ID 到数组

转载 作者:行者123 更新时间:2023-12-01 10:10:57 25 4
gpt4 key购买 nike

我正在尝试比较两个列表。一个列表包含我在 Twitter 上关注的每个人,另一个列表包含关注我的每个人。我不知道如何执行此操作,因为 .getFollowersIDs 和 .getFriendsIDs 属于 ID 类型。我查过这个,但我不明白如何比较这种类型的结果。我尝试将它们视为数组,但 Eclipse 不喜欢这样。 http://twitter4j.org/javadoc/twitter4j/IDs.html

The type of the expression must be an array type but it resolved to IDs

package com.follow3d.rob;

import java.util.List;
import twitter4j.*;
import twitter4j.conf.*;

public class Follow3d {

public static void main(String[] args) {

ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true).setOAuthConsumerKey("xxxxxx")
.setOAuthConsumerSecret("xxxxxx")
.setOAuthAccessToken("xxxxxx")
.setOAuthAccessTokenSecret("xxxxxx");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
try {
long ID = twitter.getId();//Personal Twitter ID.
IDs FOLLOWERS = twitter.getFollowersIDs(-1);//Numeric Array of every user that follows me.
IDs FOLLOWING = twitter.getFriendsIDs(-1);//Numeric Array of every user I am following.
while (FOLLOWING.hasNext() == true)
{
int counter = 0;
if (FOLLOWING[counter] != FOLLOWERS[counter])//ERROR HERE.
}
} catch (TwitterException name) {
System.out.println("You don't have internet connection.");
}
}
}

最佳答案

IDs::getIDs()给你一个long[]。我想这就是你想要的。

关于java - Twitter4j ID 到数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36119406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com