完美数分类的两种Java实现方式

Reference: Functional Thinking Chapter 2

// Java的命令式实现

import java.util.Map;

import java.util.HashMap;

import java.util.Set;

import java.util.HashSet;

public class ImpNumberClassifierSimple {

private int number = 0;

private Map<Integer, Integer> cache;

public ImpNumberClassifierSimple() {......

NameCleaner Class

Java Generic Classes

// Reference: http://tutorials.jenkov.com/java-generics/index.html

import java.util.List;

import java.util.ArrayList;

import java.util.Set;

import java.util.HashSet;

import java.util.Map;

import java.util.HashMap;

public class JavaGenericsTutorial {

public static void main(String[] args) {

System.......

通过循环和函数式两种方法进行词频统计

// Reference: Functional Thinking Chapter 1

import java.util.List;

import java.util.ArrayList;

import java.util.Set;

import java.util.HashSet;

import java.util.Map;

import java.util.TreeMap;

import java.util.regex.*;

public class WordsCounter {

public static HashSet<String> NON_WORDS = new H......