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
import org.slf4j.helpers.MessageFormatter; | |
/** | |
* @author thinkam | |
* @date 2018/07/22 | |
*/ | |
public class StringFormatterUtil { | |
/** | |
* elegant and efficient way to format string |
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> nameList = Lists.transform(departmentDtoList, new Function<DepartmentDto, String>() { | |
@Nullable | |
@Override | |
public String apply(@Nullable DepartmentDto input) { | |
return input != null ? input.getDepartmentName() : null; | |
} | |
}); |
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
/** | |
* 去除数组重复元素(不改变原数组),返回ArrayList,并保持原来元素顺序 | |
* | |
* @author yanganyu | |
* @date 2018/7/4 9:27 | |
* @param array 泛型数组 | |
* @return 保持顺序的且元素不重复的ArrayList | |
*/ | |
public static <T> ArrayList<T> removeDuplicateInOrder(T[] array) { | |
return new ArrayList<T>(new LinkedHashSet<T>(Arrays.asList(array))); |
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
/** | |
* 去除数组重复元素(不改变原数组),返回ArrayList,不保持原来元素顺序 | |
* | |
* @author yanganyu | |
* @date 2018/7/4 9:27 | |
* @param array 泛型数组 | |
* @return 元素不重复的ArrayList(不保持原来元素顺序) | |
*/ | |
public static <T> ArrayList<T> removeDuplicate(T[] array) { | |
return new ArrayList<T>(new HashSet<T>(Arrays.asList(array))); |
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
#!/bin/bash | |
# open a symbolic link's real path in nautilus | |
# create an executable file in ~/.local/share/nautilus/scripts | |
# reference: https://askubuntu.com/questions/411430/open-the-parent-folder-of-a-symbolic-link-via-right-click | |
# reference: https://help.ubuntu.com/community/NautilusScriptsHowto | |
if [ -h $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS ]; then | |
nautilus "$(readlink $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS)" | |
else | |
zenity --info --text="$(basename "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS") is not a symbolic link" |
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
// brief (brief = complex) | |
public List<EnvConfigGroupVo> listEnvConfigGroupVoFrom1(List<EnvConfigVo> envConfigVoList) { | |
ListMultimap<Integer, EnvConfigVo> multimap = ArrayListMultimap.create(); | |
envConfigVoList.forEach(e -> multimap.put(e.getGroupType(), e)); | |
return multimap.keySet().stream() | |
.map(k -> new EnvConfigGroupVo(k, EnvConfigGroupTypeEnum.getByValue(k).getDesc(), multimap.get(k))) | |
.collect(Collectors.toList()); | |
} | |
// complex |
- (添加/编辑
.gitignore
) - 执行
git rm --cached -r .idea
- 执行
git commit -m "remove remote .idea"
- 执行
git push origin master
- 在第一次commit前添加.gitignore
- 参考一个编程规范
- 解决IDE本身检测出来的问题
- 使用静态代码扫描工具
- 阅读开源框架、库源码
- 阅读相关书籍
- 代码大全
- 重构
- 代码整洁之道
OlderNewer