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
List<String> list = Lists.newArrayList("sweet", "baby", "jesus"); | |
List<String> reversed = Lists.newArrayList(); | |
for(String item: list) { | |
String reversedString = new StringBuilder(item).reverse().toString(); | |
reversed.add(reversedString); | |
} |
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
transform | |
public static <F,T> List<T> transform(List<F> fromList, | |
Function<? super F,? extends T> function) | |
Returns a list that applies function to each element of fromList. The returned list is a transformed view of fromList; changes to fromList will be reflected in the returned list and vice versa. | |
Since functions are not reversible, the transform is one-way and new items cannot be stored in the returned list. The add, addAll and set methods are unsupported in the returned list. | |
The function is applied lazily, invoked when needed. This is necessary for the returned list to be a view, but it means that the function will be applied many times for bulk operations like List.contains(java.lang.Object) and List.hashCode(). For this to perform well, function should be fast. To avoid lazy evaluation when the returned list doesn't need to be a view, copy the returned list into a new list of your choosing. |
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
List<Item> items = productCatalogClient.callEndpoint(getEndpoint(), map); | |
List<String> styleNames = Lists.transform(items, new Function<Item, String>() { | |
@Override | |
public String apply(Item item) { | |
return item.getStyleName(); | |
} | |
}); | |
// Save the styleNames in Cache | |
CacheUtil.getCache(FILTER_QUERY_CACHE_NAME).put(new Element(key, styleNames)); |
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
2012-01-25 20:53:29,100 4079 [QuorumPeer[myid=119]/90.0.0.2:2888] DEBUG org.apache.zookeeper.server.quorum.CommitProcessor - Committing request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a | |
2012-01-25 20:53:29,100 4079 [CommitProcessor:119] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a | |
2012-01-25 20:53:29,100 4079 [CommitProcessor:119] TRACE org.apache.zookeeper.server.FinalRequestProcessor - :Esessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a | |
2012-01-25 20:53:29,145 4124 [QuorumPeer[myid=119]/90.0.0.2:2888] DEBUG org.apache.zookeeper.server.quorum.CommitProcessor - Committing request:: sessionid:0x1e3516a4f8520001 type:setData cxid:0x4f206ccf zxid:0xf0000002e txntype:5 reqpath:n/a | |
2012-01-25 20:53:29,145 4124 [CommitProcessor:119] DEBUG org.apache.zookeeper.server.FinalRequestProce |
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
2012-01-25 20:53:29,098 4077 [CommitProcessor:119] DEBUG Ignoring processTxn failure hdr: -1 : error: -110 org.apache.zookeeper.server.DataTree | |
2012-01-25 20:53:29,100 4079 [QuorumPeer[myid=119]/90.0.0.2:2888] DEBUG Committing CREATE request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a -org.apache.zookeeper.server.quorum.CommitProcessor | |
2012-01-25 20:53:29,100 4079 [CommitProcessor:119] DEBUG Processing CREATE request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a -org.apache.zookeeper.server.FinalRequestProcessor | |
2012-01-25 20:53:29,100 4079 [CommitProcessor:119] TRACE :Esessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a -org.apache.zookeeper.server.FinalRequestProcessor | |
2012-01-25 20:53:29,145 4124 [QuorumPeer[myid=119]/90.0.0.2:2888] DEBUG Committing SETDATA request:: sessionid:0x1e3516a4f8520001 type:setData cxid:0x4f206ccf zxid:0xf0000002e txntype:5 reqpa |
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
2012-01-25 20:53:29,098 4077 [CommitProcessor:119] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request:: sessionid:0x1e3516a4f8520001 type:error cxid:0x4f206ca8 zxid:0xf0000002c txntype:-1 reqpath:n/a | |
2012-01-25 20:53:29,098 4077 [CommitProcessor:119] TRACE org.apache.zookeeper.server.FinalRequestProcessor - :Esessionid:0x1e3516a4f8520001 type:error cxid:0x4f206ca8 zxid:0xf0000002c txntype:-1 reqpath:n/a | |
2012-01-25 20:53:29,098 4077 [CommitProcessor:119] DEBUG org.apache.zookeeper.server.DataTree - Ignoring processTxn failure hdr: -1 : error: -110 | |
2012-01-25 20:53:29,100 4079 [QuorumPeer[myid=119]/90.0.0.2:2888] DEBUG org.apache.zookeeper.server.quorum.CommitProcessor - Committing request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf0000002d txntype:1 reqpath:n/a | |
2012-01-25 20:53:29,100 4079 [CommitProcessor:119] DEBUG org.apache.zookeeper.server.FinalRequestProcessor - Processing request:: sessionid:0x1e3516a4f8520001 type:create cxid:0x4f206cac zxid:0xf000 |