title: java 8 syntax conversion for processing 2 (twitter4j)
body: <p>I was informed that this code will not work in processing because it is java 8 syntax, which is not supported in processing. I need help converting it to work in processing. What syntax can Processing 2 handle? Is there a way to convert the java 8 syntax to work within Processing 2?</p>
  
  <pre><code>public static void main (String args[]) throws TwitterException {
      Twitter twitter = new TwitterFactory().getInstance();
      List&lt;Status&gt; statuses = twitter.getUserTimeline("google");
      String hashtag = "#AlphaGo";
      System.out.println("The Twitter page contains " 
                          + countTweets(hashtag, statuses) 
                          + " tweets with the hashtag : " + hashtag);
  
  }
  
  public static int countTweets(String hashtag, List&lt;Status&gt; statuses){
      return (int) statuses.stream()
                           .filter(x -&gt; x.getText().contains(hashtag))
                           .count();
  }
  </code></pre>
  
  <p>Since Im having problems with declaring variables:
  CURRENT VERSION</p>
  
  <pre><code>ConfigurationBuilder cb = new ConfigurationBuilder();
  Twitter twitterInstance;
  Query queryForTwitter;
  ArrayList&lt;Status&gt; tweets = new ArrayList&lt;Status&gt;();
  
  //ArrayList tweets;
  
  void setup() {
    cb.setOAuthConsumerKey("xxx");
    cb.setOAuthConsumerSecret("xxx");
    cb.setOAuthAccessToken("xxx");
    cb.setOAuthAccessTokenSecret("xxx");
    cb.setUseSSL(true);
  
    size(640,440);
  
  int countTweets(ArrayList&lt;Status&gt; statuses, String hashtag){
    int total = 0;
    for(Status tweet : statuses){
      if(tweet.getText().contains(hashtag)){
        total++;
      }
    }
    return total;
  }
  
     int numGood = 50;
     int numBad = 50;
    for (int i = 0; i &lt; numGood; i++) {
      tweets.add("#good");
    }
    for (int i = 0; i &lt; numBad; i++) {
      tweets.add("#bad");
    }
  
  } //setup
  
  //create a function that counts the tweets
  //that contain a certain hashtag
  int countTweets(String hashtag){
    int total = 0;
    for(String tweet : tweets){
      if(tweet.contains(hashtag)){
        total++;
      }
    }
    return total;
  }
  
  void draw(){
  
    //count the good and bad tweets
    int goodTweets = countTweets("#good");
    int badTweets = countTweets("#bad");
  
    //calculate color based on tweet counts
    float r = badTweets/100.0 * 255;
    float g = goodTweets/100.0 * 255;
    float b = 0;
  
    background(r, g, b);
  
  }
  </code></pre>