当前位置:网站首页>Collation of common tools in commons Lang
Collation of common tools in commons Lang
2022-07-22 03:57:00 【Youth never ends】
One 、commons-lang3
1、 character string , Numbers , date , Array and other tool classes
StringUtils String utility class
Including judgment methods :contains/containsXXX
String substitution method :replace/replaceXXX
Get substring :substring/substringXXX
Judgment method :
1、isEmpty/isNotEmpty/isBlank/isNotBlank/isNumeric/isWhitespace
2、sartsWith/startsWithAny/endsWith/endsWithIgnoreCase
Indexes (index):indexOf/indexOfXXX/tIndexOf/lastIndexOfXXX
processing method :
abbreviate To shorten the capitalise The first letter repeat repeat left/right/center Left and right middle
removeXXX remove trimXXX Go empty reverseXXX Flip stripXXX remove
defaultXXX Default lowerCase/upperCase deleteXXX Delete processing
splitXXX Decomposition treatment join Splicing
StringEscapeUtils
escapeCsv/unescapeCsv/escapeHtml/unescapeHtml/escapeJava/unescapeJava
escapeJavaScript/unescapeJavaScript/escapeXml/unescapeXml/escapeSql
NumberUtils Digital tools
Create numbers :createXXX establish Integer,Float,Double,Number,BigDecimal,BigInteger Equal number
Character to number :toXXX String to number :Byte,Double,Float,Int,Long,Short
Judge whether it's a number :isDigits/isNumber
Other methods :compare,max,min,
ArrayUtils Array utility class
Add remove :add,addAll,remove,removeElement,
Copy :clone
Judge :contains,isEmpty,isNotEmpty,isEquals,isSameLength,
other :getLength,indexOf,lastIndexOf,nullToEmpty,reverse,subArray,
transformation :toMap,toObject,toPrimitive,toString
RandomUtils Random number tool class
nextBoolean/nextInt/nextLong/nextFloat/nextDouble
RandomStringUtils Random string tool class
random/randomNumeric/randomAlphabetic/randomAscii
DateUtils Date tool class
explain :XXX Express milisecends,seconds,minutes,hours,days,weeks,months,years
Time plus minus :add/addXXX
Set the time : setXXX
Get the clip : getFragmentInXXX obtain date Of 1 month 1 Japan 0 spot 0 branch 0 The fragment value from seconds to the specified time
Judge : isSameDay/isSameInstant/isSameLocalTime
transformation : parseDate/parseDateStrictly
modulus : ceiling/round/truncate
Period of time :iterator Be careful rangeStyle=1 To 4 Indicates the range of weeks and the offset ,5 and 6 Indicates the month offset
DateFormatUtils Time format
format :format/formatUTC
DurationFormatUtils Time period formatting
formatDuration/formatDurationHMS/formatDurationISO
formatPeriod/formatPeriodISO
formatDurationWords
StopWatch Stopwatch
start/stop/suspend/split/resume/reset/unsplit
getSplitTime/getStartTime/getTime/
toSplitString/toString
EnumUtils Enumerate utility classes
getEnum/getEnumIgnoreCase/getEnumList/getEnumMap
iterator
2、java Reflection tools
ClassUtils Class tools
obtain :
1、 Classes and interfaces :getClass/getAllInterfaces/getAllSuperclasses/getShortClassName
2、 package :getPackageName/getPackageCanonicalName
3、 Method :getPublicMethod
transformation :
1、toClass/convertClassesToClassNames/convertClassNamesToClasses/
2、primitivesToWrappers/primitiveToWrapper/wrappersToPrimitives/wrapperToPrimitive
Judge :isAssignable/isInnerClass
MethodUtils
getAccessibleMethod/getMatchingAccessibleMethod
invokeMethod/invokeStaticMethod/invokeExactMethod/invokeExactStaticMethod
FieldUtils Field tool class
getField/readField/writeField
getDeclaredField/readDeclaredField/writeDeclaredField
readDeclaredStaticField/readStaticField/writeDeclaredStaticField/writeStaticField
ConstructorUtils
getAccessibleConstructor/getMatchingAccessibleConstructor
invokeConstructor/invokeExactConstructor
ObjectUtils Object tool class
max/min/toString/identityToString/appendIdentityToString/defaultIfNull
SystemUtils System properties tool class
getJavaHome/getJavaIoTmpDir/getJavaVersion/getUserDir/getUserHome/
isJavaAwtHeadless/isJavaVersionAtLeast
LocaleUtils Local tools
availableLocaleList/availableLocaleSet
countriesByLanguage
localeLookupList/toLocale/isAvailableLocale/languagesByCountry
SerializationUtils Serialization tool class
clone/deserialize/serialize
Two 、commons-collecions package
CollectionUtils Collection tool class
add to / Delete :addAll/addIgnoreNull/retainAll/removeAll/
obtain :
find/get/containsAny/index/size/sizeIsEmpty/select/selectRejected/subtract
typedCollection
Judge :
isEmpty/isNotEmpty/isFull/exists/isEqualCollection/
isSubCollection/isProperSubCollection
transformation :
collect/transform/transformedCollection/predicatedCollection
unmodifiableCollection/synchronizedCollection
Calculation :cardinality/countMatches/maxSize
Filter :filter
aggregate :intersection/union/disjunction intersection , Combine , Difference set
Other operating :
reverseArray Flip forAllDo Execute closures for each element
getCardinalityMap Turn into Map,key Is an element ,value It's the number of times
ListUtils-List Tool class
Judge : isEqualList
aggregate :intersection/sum/union/retainAll intersection , Combine , Collection , Difference set
operation :removeAll/hashCodeForList
A subset of : typedList/subtract/fixedSizeList
Conversion processing :synchronizedList/unmodifiableList/predicatedList/transformedList/lazyList
SetUtils-Set Collection tool class
Judge :isEqualSet
Conversion processing :
transformedSet/transformedSortedSet/predicatedSet/predicatedSortedSet
unmodifiableSet/synchronizedSet/synchronizedSortedSet
orderedSet/typedSet/typedSortedSet
operation :hashCodeForSet
MapUtils-Map Tool class
obtain :getObject/getString/getXXX/getXXXValue Get the value of the specified type ,getXXXValue If there is no value, the default value
A subset of :fixedSizeMap/fixedSizeSortedMap/typedMap/typedSortedMap
Judge :isEmpty/isNotEmpty
transformation :
predicatedMap/predicatedSortedMap/transformedMap/transformedSortedMap/
synchronizedMap/synchronizedSortedMap/
unmodifiableMap/unmodifiableSortedMap/multiValueMap/orderedMap
toMap/toProperties/lazyMap/lazySortedMap
Add remove :safeAddToMap/putAll
Other operating :invertMap/debugPrint/verbosePrint
Other tools
MultiKey - by Map More customized Key
Map map = new HashMap();
MultiKey multiKey = new MultiKey(key, locale);
map.put(multiKey, localizedText);
// later retireve the localized text
MultiKey multiKey = new MultiKey(key, locale);
String localizedText = (String) map.get(multiKey);
The main method : getKey,getKeys,size
Functions are programming classes
// Preprocessing functions
AllPredicate/AndPredicate/AnyPredicate/UniquePredicate/NonePredicate/IdentityPredicate
EqualPredicate/FalsePredicate/TruePredicate/ExceptionPredicate
NullPredicate/OnePredicate/OrPredicate/InstanceofPredicate
TransformedPredicate/TransformerPredicate/NullIsFalsePredicate/NullIsTruePredicate
NotNullPredicate
NotPredicate
// Closure function
ChainedClosure/ExceptionClosure/WhileClosure/ForClosure/IfClosure/NOPClosure
TransformerClosure/SwitchClosure/NullIsExceptionPredicate
// Conversion processing
ChainedTransformer/CloneTransformer/ClosureTransformer/ConstantTransformer
ExceptionTransformer/FactoryTransformer/MapTransformer/InstantiateTransformer
NOPTransformer/PredicateTransformer/StringValueTransformer/SwitchTransformer
InvokerTransformer
// factory
ConstantFactory/ExceptionFactory/InstantiateFactory/PrototypeFactory
3、 ... and 、commons-io package
FileUtils File operation tool class
Folder operation :
copyDirectory/deleteDirectory/cleanDirectory/getTempDirectory/getTempDirectoryPath
moveDirectory/moveDirectoryToDirectory/moveFileToDirectory/moveToDirectory
forceMkdir/getUserDirectory/getUserDirectoryPath
File operations :
touch/copyFile/copyURLToFile/moveFile/deleteQuietly/forceDelete/forceDeleteOnExit
toFile/toFiles/toURLs
isFileNewer/isFileOlder
readLines/readFileToByteArray/readFileToString/lineIterator/openOutputStream
write/writeLines/writeByteArrayToFile/writeStringToFile/openInputStream
Other operating :
iterateFiles/listFiles/contentEquals/sizeOf/sizeOfDirectory
IOUtils Stream operation tool class
Read operations :lineIterator/read/readLines
Write operations :write/writeLines
transformation : toInputStream/toBufferedInputStream/toByteArray/toCharArray/toString
Other operating :copy/copyLarge/contentEquals/skip/skipFully/closeQuietly
FilenameUtils File name tool class
obtain :
getName/getBaseName/getPrefix/getPrefixLength/getExtension
getPath/getFullPath/getFullPathNoEndSeparator/getPathNoEndSeparator
Judge :
isExtension/equals/equalsNormalized/equalsOnSystem
Other operating :
removeExtension/indexOfExtension
separatorsToSystem/separatorsToUnix/separatorsToWindows
indexOfLastSeparator
Other tools
File comparator :
CompositeFileComparator/DefaultFileComparator/DirectoryFileComparator
ExtensionFileComparator/LastModifiedFileComparator/NameFileComparator
PathFileComparator/PathFileComparator
File filter :
AgeFileFilter/AndFileFilter/CanReadFileFilter/CanWriteFileFilter
DelegateFileFilter/DirectoryFileFilter/EmptyFileFilter/FalseFileFilter/FileFileFilter
FileFilterUtils/HiddenFileFilter/MagicNumberFileFilter/NameFileFilter/NotFileFilter
OrFileFilter/PrefixFileFilter/RegexFileFilter/SizeFileFilter/SuffixFileFilter
TrueFileFilter/WildcardFileFilter/WildcardFilter
Four 、commons-beanutils package
BeanUtils/BeanUtilsBean
Copy : cloneBean/copyProperties/copyProperty
obtain :getArrayProperty/getSimpleProperty/getProperty
Other operating :setProperty Set properties populate take Bean Set to Map in describe take Bean Turn into Map
PropertyUtils class
Judge :isReadable/isWriteable
obtain :
getProperty/getSimpleProperty/getPropertyType
getReadMethod/getWriteMethod/getIndexedProperty/setIndexedProperty
getMappedProperty/setMappedProperty/getNestedProperty/setNestedProperty
getPropertyDescriptor/getPropertyEditorClass
Copy and set :copyProperties/setProperty/setSimpleProperty /clearDescriptors
ConstructorUtils
getAccessibleConstructor/invokeConstructor/invokeExactConstructor
ConvertUtils
Set up :setDefaultBoolean/setDefaultByte/setDefaultCharacter/setDefaultDouble/
setDefaultFloat/setDefaultInteger/setDefaultLong/setDefaultShort/
obtain :getDefaultBoolean/getDefaultByte/getDefaultCharacter/getDefaultDouble/getDefaultFloat/
getDefaultInteger/getDefaultLong/getDefaultShort/
transformation :convert/
other :deregister/lookup/register/primitiveToWrapper/
MethodUtils
obtain :getAccessibleMethod/getMatchingAccessibleMethod/getPrimitiveType/getPrimitiveWrapper
other :invokeExactMethod/invokeMethod/isAssignmentCompatible/toNonPrimitiveClass
边栏推荐
- JS高级 之 ES5 实现继承
- PCIE链路初始化&训练
- Serial Vector Format(SVF)文件格式
- 百度世界2022,明天见!
- Upload and download Excel files from the browser to the database
- About thread Sleep() method
- Idea建文件夹时,文件夹的空文件夹的展开与重叠
- System
- 3.3栈和队列的应用
- Li Shuo, vice president of Baidu: AI can go deep into the scene and create real value. From sensors to large screens, it is just the beginning of digitalization
猜你喜欢
[译] PostgreSQL 怎么决定PG 的备份策略
严蔚敏第二章课后习题(2.29-2.38)
When idea creates a folder, the empty folder of the folder expands and overlaps
科创人·观远数据CEO苏春园:让业务用起来,是BI行业推倒渗透率之墙的关键
TCL/TK文件操作
Natural language Processing in tensorflow quizs on Coursera
3.1栈
JS高级 之 ES5 实现继承
asp.net coree文件上传与下载实例
Field injection is not recommended怎么处理
随机推荐
Convolutional Neural Networks in TensorFlow quizs on Coursera
关于动态申请二位数组的问题
Arrays
After reading "what to read in college?"
大型体育场馆应急照明设计
Flink reports an error when executing SQL using API
PCIE链路初始化&训练
Integer
Monai label -- use AI to accelerate your segmentation annotation
System
eBPF验证器
taokeeper环境搭建
湘潭市党政代表团莅临麒麟信安调研考察
3.3栈和队列的应用
MySQL索引原理以及查询优化「建议收藏」
日期工具类
Date tool class
百度世界2022,明天见!
2.2线性表的顺序表示
Application of SCA on devsecops platform