StringUtils.isNotBlank() VS StringUtils.isNotEmpty() in Java
See nice examle for StringUtils.isNotBlank() VS StringUtils.isNotEmpty() in Java
Here https://www.javavogue.com/2015/04/stringutilsisnotblank-vs-html/




#sam reid#interview with the vampire#the vampire lestat#iwtv
seen from United States
seen from United States

seen from Switzerland

seen from United States

seen from Switzerland
seen from China
seen from Yemen
seen from France

seen from Türkiye

seen from United States
seen from Malaysia

seen from Bolivia

seen from France

seen from Malaysia
seen from Singapore
seen from United States

seen from United States

seen from United States
seen from United States

seen from Malaysia
StringUtils.isNotBlank() VS StringUtils.isNotEmpty() in Java
See nice examle for StringUtils.isNotBlank() VS StringUtils.isNotEmpty() in Java
Here https://www.javavogue.com/2015/04/stringutilsisnotblank-vs-html/
StringUtils examples
We may use String manipulations in most occasions, be it replace, concat. There is a utility class which includes most of the String operations and manipulations in commons-lang library. StringUtils Download StringUtils class comes as part of apache commons-lang library. Before using, this please include the jar in your classpath. You can download this from…
StringUtils examples was originally published on
Java split() 메소드 성능 비교
split() 메소드 성능을 비교하는 블로그 글(Guava Splitter vs StringUtils)을 보고 간단한 테스트 프로그램을 작성해 보았다. 아래 프로그램은 String.split(), StringUtils.split(), Guava Splitter.split() 메소드를 이용해 문자열을 공백으로 분리하고 문자열 길이를 확인한다.
import com.google.common.base.Splitter; import org.apache.commons.lang.StringUtils; public class SplitPerformance { public Long[] doPerformanceTest(int repeatCount) { String log = "2013-03-19 10:00:06 10.1.1.60 - - - 10.2.1.213 80 GET " + "/images/400x280.jpg - 200 1 4008054 21400 - 1 " + "HTTP/1.1 image.unknown.net - - - 1 - 1 1 image/jpeg 1342 400 - - 1"; long before, after; before = System.currentTimeMillis(); for (int i = 0; i < repeatCount; ++i) { String[] logList = log.split(" "); for (String aLogList : logList) { int len = aLogList.length(); } } after = System.currentTimeMillis(); long stringSplit = after - before; before = System.currentTimeMillis(); for (int i = 0; i < repeatCount; ++i) { String[] logList = StringUtils.split(log); for (String aLogList : logList) { int len = aLogList.length(); } } after = System.currentTimeMillis(); long stringUtilsSplit = after - before; Splitter splitter = Splitter.on(" "); before = System.currentTimeMillis(); for (int i = 0; i < repeatCount; ++i) { Iterable<String> logIterator = splitter.split(log); for (String aLogList : logIterator) { int len = aLogList.length(); } } after = System.currentTimeMillis(); long guavaSplitterSplit = after - before; return new Long[] { stringSplit, stringUtilsSplit, guavaSplitterSplit }; } public void printResult(int repeatCount, Long[] results) { System.out.println( String.format("%d\t%d\t%d\t%d", repeatCount, results[0], results[1], results[2])); } public static void main(String[] args) { SplitPerformance splitPerformance = new SplitPerformance(); System.out.println("Repeat\tString.split()\tStringUtils.split()\tSplitter.split()"); for (int repeat = 10; repeat <= 10000000; repeat *= 10) { Long[] results = splitPerformance.doPerformanceTest(repeat); splitPerformance.printResult(repeat, results); } } }
실행 결과는 다음과 같다
Repeat String.split() StringUtils.split() Splitter.split() 10 3 7 2 100 13 7 12 1000 64 5 55 10000 128 23 30 100000 208 103 175 1000000 2111 979 2065 10000000 22318 10052 19357
앞에서부터 순서대로 String.split(), StringUtils.split(), Guava Splitter.split() 메소드 실행 결과이며, 실행 시간을 나타내기 때문에 숫자가 작을 수록 좋다.
Splitter.split() 실행 결과가 생각보다 느리게 나왔는데, 아무래도 Iterator 를 이용해 문자열에 접근하기 때문이 아닌가 생각된다.