Package com.xxl.tool.emoji.loader
Class EmojiTrie
java.lang.Object
com.xxl.tool.emoji.loader.EmojiTrie
emoji trie
字典树:哈希树的变种,用于统计和排序大量的字符串,最大限度地减少无谓的字符串比较,查询效率比哈希表高。
Trie树的插入、删除、查找的操作都是一样的,只需要简单的对树进行一遍遍历即可,时间复杂度:O(n)(n是字符串的长度)。
- Author:
- xuxueli 2018-07-06 20:15:22
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfind emoji by unicodeisEmoji(char[] sequence) check if contain (full or partially) an emoji.
-
Constructor Details
-
EmojiTrie
construct trie treeEmoji-A:abc Emoji-B:abd Emoji-C:abef
root -- a -- b -- c (Emoji-A) -- d (Emoji-B) -- e -- f (Emoji-C)
- Parameters:
emojis-
-
-
Method Details
-
isEmoji
check if contain (full or partially) an emoji.Matches.EXACTLY : if char sequence in its entirety is an emoji Matches.POSSIBLY : if char sequence matches prefix of an emoji Matches.IMPOSSIBLE : if char sequence matches no emoji or prefix of an
- Parameters:
sequence-- Returns:
-
getEmoji
find emoji by unicode- Parameters:
unicode-- Returns:
-