Home [Development] Apache / Spring Utils
Post
Cancel

[Development] Apache / Spring Utils

DateUtils

1
import org.apache.commons.lang3.time.DateUtils; 

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DateUtils.html

  • truncate

  • addMilliseconds
    1
    2
    
    Date now = new Date();
    Date new = DateUtils.addMilliseconds(now, -1);
    
  • addDays
    1
    2
    
    Date now = new Date();
    DateUtils.addDays(now, 1);
    
  • ceiling

  • parseDate
1
2
Date now = new Date();
Date parse = DateUtils.parseDate(now, "yyyyMMdd", "yyyy-MM-dd");

StringUtils

1
2
3
import org.springframework.util.StringUtils;

import org.apache.commons.lang3.StringUtils;
  • spring

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/StringUtils.html

  • apache

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html


CollectionUtils

1
2
3
import org.springframework.util.CollectionUtils;

import org.apache.commons.collections4.CollectionUtils;
  • spring

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/CollectionUtils.html

  • apache

https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/CollectionUtils.html


ObjectUtils

1
2
3
import org.springframework.util.ObjectUtils;

import org.apache.commons.lang3.ObjectUtils;
  • spring

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/util/ObjectUtils.html

  • apache

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/ObjectUtils.html


NumberUtils

1
import org.apache.commons.lang3.math.NumberUtils;

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/math/NumberUtils.html

This post is licensed under CC BY 4.0 by the author.

[Medium] Swapping Nodes in a Linked List

[Tokyo] Go Travel to Taiwan

Comments powered by Disqus.