This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* this code gets users who follow a authorized user in twitter with twitter4j. | |
* @param twitter | |
* @param screenName | |
* @return if a error occurs, this method returns null | |
*/ | |
public static ArrayList<twitter4j.User> getFollowingUsers2(Twitter twitter, String screenName){ | |
long start = System.currentTimeMillis(); | |
long end = 0; | |
PagableResponseList<twitter4j.User> rawData = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// forkを利用してみたいからこの1行だけ追加してみた! | |
// test using: 1)Groovy Console Java Web Start | |
// http://dl.getdropbox.com/u/653108/groovy/console.jnlp | |
// | |
// 2)IntelliJ 10.0.1 CE | |
// Grape Plugin : http://plugins.intellij.net/plugin/?idea&id=4702 | |
// | |
// reference site: bluepapa32’s site | |
// http://d.hatena.ne.jp/bluepapa32/20101228/1293466511 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 一人分のTwitterUserData2を保存。既に保存されていた場合は重複して保存してしまう<br> | |
* 既存のデータをこのメソッド呼出より前に削除する必要あり<br> | |
* 削除せずに更新したほうが効率がよい | |
* @param data フォロー、フォロワー、データ作成日等を含むオブジェクト | |
* @param updateCount 更新回数。レガシーな理由によりこういう形になった | |
* @return 保存が成功したかどうか | |
*/ | |
public static boolean storeTwitterUserData2(TwitterUserData2 data, int updateCount){ | |
if(data == null || data.getFollowingUsers() == null || data.getFollowersUsers() == null || data.getCreatedDate() == null){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package util; | |
import java.util.Collections; | |
import java.util.logging.Logger; | |
import javax.cache.Cache; | |
import javax.cache.CacheException; | |
import javax.cache.CacheFactory; | |
import javax.cache.CacheManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package getAccessToken; | |
import java.io.IOException; | |
import java.util.logging.Logger; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import twitter4j.Twitter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* すべてのArrayListに共通するユーザを見つける | |
* @param <T> | |
* @param listOfUsers | |
* @return | |
*/ | |
public static <T> ArrayList<T> getCommonUsers(List<ArrayList<T>> listOfUsers){ | |
if(listOfUsers == null) | |
return null; | |
if(listOfUsers.size() == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ArrayList<String> sortDescending(HashMap<String, Integer> map){ | |
ArrayList<String> dataToReturn = new ArrayList<String>(); | |
Set<String> keySet = map.keySet(); | |
for(int i = 0; i < keySet.size(); i++){ | |
int maxCount = -1; | |
String maxName = ""; | |
for(String name: keySet){ | |
boolean alreadyAdded = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ArrayList<String> addAll(List<String> users1, List<String> users2){ | |
ArrayList<String> dataToReturn = new ArrayList<String>(users1); | |
dataToReturn.addAll(users2); | |
return dataToReturn; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* かなり厳密に、キャッシュが存在するかどうか確かめる | |
* このコストを避けたい場合は、このメソッドを呼ばずに直接取得する | |
* @param <T> | |
* @param key | |
* @param type | |
* @return | |
*/ | |
public static <T> boolean isCached(String key, T type){ | |
Cache cache = getCache(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import java.util.ArrayList; | |
public class Test { | |
public Test() { | |
ok(); | |
bad(); | |
} |
OlderNewer