Source:
<code>public void addTwitterExtensions(Activity activity, Twitter twitter, Interaction interaction) { Retweet retweet = twitter.getRetweet(); Map<String, Object> extensions = ensureExtensions(activity); List<String> hashTags = Lists.newLinkedList(); List<Object> hts = Lists.newLinkedList(); if(twitter.getHashtags() != null) { hts = twitter.getHashtags(); } else if (retweet != null) { hts = retweet.getHashtags(); } if(hts != null) { for(Object ht : twitter.getHashtags()) { if(ht instanceof String) { hashTags.add((String) ht); } else { LOGGER.warn("Hashtag was not instance of String : {}", ht.getClass().getName()); } } } extensions.put("hashtags", hashTags); if(retweet != null) { Map<String, Object> rebroadcasts = Maps.newHashMap(); rebroadcasts.put("perspectival", true); rebroadcasts.put("count", retweet.getCount()); extensions.put("rebroadcasts", rebroadcasts); } if(interaction.getAdditionalProperties() != null) { ArrayList<String> mentions = (ArrayList<String>) interaction.getAdditionalProperties().get("mentions"); ArrayList<Long> mentionIds = (ArrayList<Long>) interaction.getAdditionalProperties().get("mention_ids"); ArrayList<UserMentions> userMentions = new ArrayList<UserMentions>(); <START> if(mentions != null && mentionIds != null && (mentionIds.size() == mentions.size()) && !mentions.isEmpty() && !mentionIds.isEmpty()) { <END> for(int x = 0; x < mentions.size(); x ++) { UserMentions mention = new UserMentions(); mention.setIdStr("id:twitter:" + mentionIds.get(x)); mention.setId(mentionIds.get(x)); mention.setName(mentions.get(x)); mention.setScreenName(mentions.get(x)); userMentions.add(mention); } extensions.put("user_mentions", userMentions); } } extensions.put("keywords", interaction.getContent()); }</code><technical_language>is 100% completely accurate assert IDs match handles, I create a object for a downstream processor merge checking twitter API. completely disregard other. want discuss this list get other opinions</technical_language>

Target:
public void addTwitterExtensions(Activity activity, Twitter twitter, Interaction interaction) { Retweet retweet = twitter.getRetweet(); Map<String, Object> extensions = ensureExtensions(activity); List<String> hashTags = Lists.newLinkedList(); List<Object> hts = Lists.newLinkedList(); if(twitter.getHashtags() != null) { hts = twitter.getHashtags(); } else if (retweet != null) { hts = retweet.getHashtags(); } if(hts != null) { for(Object ht : twitter.getHashtags()) { if(ht instanceof String) { hashTags.add((String) ht); } else { LOGGER.warn("Hashtag was not instance of String : {}", ht.getClass().getName()); } } } extensions.put("hashtags", hashTags); if(retweet != null) { Map<String, Object> rebroadcasts = Maps.newHashMap(); rebroadcasts.put("perspectival", true); rebroadcasts.put("count", retweet.getCount()); extensions.put("rebroadcasts", rebroadcasts); } if(interaction.getAdditionalProperties() != null) { Object mentionsObject = interaction.getAdditionalProperties().get("mentions"); if(mentionsObject != null ) { if(mentionsObject instanceof List) { List mentions = (List) mentionsObject; List<Map<String, Object>> userMentions = Lists.newLinkedList(); for(Object mention : mentions) { Map<String, Object> actor = Maps.newHashMap(); actor.put("displayName", mention); userMentions.add(actor); } extensions.put("user_mentions", userMentions); } } } extensions.put("keywords", interaction.getContent()); }