一、Collector的引入      

1)Collector的聚合作用前面已经使用过,将list.stream后的一系列操作之后再返回list。

2)Collector的引入,通过需求:将绿色的Apple放在一个list,黄色的Apple放在一个list

代码例子:

 package com.cy.java8;

 import java.util.*;
import java.util.stream.Collectors; public class CollectorIntroduce { public static void main(String[] args) {
List<Apple> list = Arrays.asList(new Apple("green", 150),
new Apple("yellow", 120),
new Apple("green", 170),
new Apple("green", 150),
new Apple("yellow", 120),
new Apple("green", 170) ); //Collector的聚合作用
List<Apple> greenList = list.stream().filter(a -> a.getColor().equals("green")).collect(Collectors.toList());
System.out.println(greenList); Map<String, List<Apple>> result1 = groupByNormal(list);
System.out.println(result1); Map<String, List<Apple>> result2 = groupByFunction(list);
System.out.println(result2); //Collector的groupBy
Map<String, List<Apple>> result3 = groupByCollector(list);
System.out.println(result3);
} /**
* 需求:将绿色的放在一个list,黄色的放在一个list
* 以前的写法
*/
private static Map<String, List<Apple>> groupByNormal(List<Apple> apples){
Map<String, List<Apple>> map = new HashMap<>(); for(Apple a : apples){
List<Apple> list = map.get(a.getColor());
if(list == null){
list = new ArrayList<>();
map.put(a.getColor(), list);
}
list.add(a);
} return map;
} /**
* 需求:将绿色的放在一个list,黄色的放在一个list
* 使用FunctionInterface的方法
* 虽然去掉了判断null的操作,但是也还是非常啰嗦,不够精简
*/
private static Map<String, List<Apple>> groupByFunction(List<Apple> apples){
Map<String, List<Apple>> map = new HashMap<>(); apples.stream().forEach(a -> {
List<Apple> colorList = Optional.ofNullable(map.get(a.getColor())).orElseGet(() -> {
List<Apple> list = new ArrayList<>();
map.put(a.getColor(), list);
return list;
});
colorList.add(a);
}); return map;
} /**
* 需求:将绿色的放在一个list,黄色的放在一个list
* 使用Collector
*/
private static Map<String, List<Apple>> groupByCollector(List<Apple> apples){
return apples.stream().collect(Collectors.groupingBy(Apple::getColor));
}
}

打印结果:

[Apple(color=green, weight=150), Apple(color=green, weight=170), Apple(color=green, weight=150), Apple(color=green, weight=170)]
{green=[Apple(color=green, weight=150), Apple(color=green, weight=170), Apple(color=green, weight=150), Apple(color=green, weight=170)], yellow=[Apple(color=yellow, weight=120), Apple(color=yellow, weight=120)]}
{green=[Apple(color=green, weight=150), Apple(color=green, weight=170), Apple(color=green, weight=150), Apple(color=green, weight=170)], yellow=[Apple(color=yellow, weight=120), Apple(color=yellow, weight=120)]}
{green=[Apple(color=green, weight=150), Apple(color=green, weight=170), Apple(color=green, weight=150), Apple(color=green, weight=170)], yellow=[Apple(color=yellow, weight=120), Apple(color=yellow, weight=120)]}

二、Collectors的API介绍和使用  

averagingDouble;

averagingInt;

averagingLong;

collectingAndThen;

counting;

groupingBy;

summarizingInt;

代码例子:

 package com.cy.java8;

 import java.util.*;
import java.util.stream.Collectors; public class CollectorsAction {
private final static List<Dish> menu = Arrays.asList(
new Dish("pork", false, 800, Dish.Type.MEAT),
new Dish("beef", false, 700, Dish.Type.MEAT),
new Dish("chicken", false, 400, Dish.Type.MEAT),
new Dish("french fries", true, 530, Dish.Type.OTHER),
new Dish("rice", true, 350, Dish.Type.OTHER),
new Dish("season fruit", true, 120, Dish.Type.OTHER),
new Dish("pizza", true, 550, Dish.Type.OTHER),
new Dish("prawns", false, 300, Dish.Type.FISH),
new Dish("salmon", false, 450, Dish.Type.FISH)); public static void main(String[] args) {
testAveragingDouble();
testAveragingInt();
testCollectingAndThen();
testCounting();
testGroupingByFunction();
testGroupingByFunctionAndCollector();
testGroupingByFunctionAndSupplierAndCollector();
testSummarizingInt();
} /**
* 计算menu中食物们卡路里的平均数
*/
private static void testAveragingDouble(){
System.out.println("testAveragingDouble");
Optional.ofNullable(menu.stream().collect(Collectors.averagingDouble(Dish::getCalories)))
.ifPresent(System.out::println);
} /**
* testAveragingInt和testAveragingLong的返回值类型也是Double,和上面类似
*/
private static void testAveragingInt(){
System.out.println("testAveragingInt");
Optional.ofNullable(menu.stream().collect(Collectors.averagingInt(Dish::getCalories)))
.ifPresent(System.out::println);
} private static void testCollectingAndThen(){
System.out.println("testCollectingAndThen");
Optional.ofNullable(menu.stream().collect(Collectors.collectingAndThen(Collectors.averagingInt(Dish::getCalories), v-> "The Average Calories is " + v)))
.ifPresent(System.out::println); } /**
* 计算list<Dish>的count
*/
private static void testCounting(){
System.out.println("testCounting");
Long count = menu.stream().collect(Collectors.counting());
System.out.println(count);
} /**
* 将menu按照type类型分组
*/
private static void testGroupingByFunction(){
System.out.println("testGroupingByFunction");
Map<Dish.Type, List<Dish>> map = menu.stream().collect(Collectors.groupingBy(dish -> dish.getType()));
System.out.println(map);
} /**
* 将menu按照type分组,并计算每个组元素数量
*/
private static void testGroupingByFunctionAndCollector(){
System.out.println("testGroupingByFunctionAndCollector");
Map<Dish.Type, Long> map1 = menu.stream().collect(Collectors.groupingBy(dish -> dish.getType(), Collectors.counting()));
System.out.println(map1); //每个类型卡路里的平均值
Map<Dish.Type, Double> map2 = menu.stream().collect(Collectors.groupingBy(dish -> dish.getType(), Collectors.averagingInt(Dish::getCalories)));
System.out.println(map2);
} /**
* Supplier mapFactory,第2个参数,可以指定传入什么类型的map
*/
private static void testGroupingByFunctionAndSupplierAndCollector(){
System.out.println("testGroupingByFunctionAndSupplierAndCollector");
Map<Dish.Type, Double> map = menu.stream().collect(Collectors.groupingBy(Dish::getType, TreeMap::new, Collectors.averagingInt(Dish::getCalories)));
System.out.println(map.getClass());
System.out.println(map);
} /**
* 将菜单menu按照卡路里进行汇总
*/
private static void testSummarizingInt(){
System.out.println("testSummarizingInt");
IntSummaryStatistics result = menu.stream().collect(Collectors.summarizingInt(Dish::getCalories));
System.out.println(result);
}
}

打印结果:

testAveragingDouble
466.6666666666667
testAveragingInt
466.6666666666667
testCollectingAndThen
The Average Calories is 466.6666666666667
testCounting
9
testGroupingByFunction
{MEAT=[Dish{name='pork', vegetarian=false, calories=800, type=MEAT}, Dish{name='beef', vegetarian=false, calories=700, type=MEAT}, Dish{name='chicken', vegetarian=false, calories=400, type=MEAT}], OTHER=[Dish{name='french fries', vegetarian=true, calories=530, type=OTHER}, Dish{name='rice', vegetarian=true, calories=350, type=OTHER}, Dish{name='season fruit', vegetarian=true, calories=120, type=OTHER}, Dish{name='pizza', vegetarian=true, calories=550, type=OTHER}], FISH=[Dish{name='prawns', vegetarian=false, calories=300, type=FISH}, Dish{name='salmon', vegetarian=false, calories=450, type=FISH}]}
testGroupingByFunctionAndCollector
{MEAT=3, OTHER=4, FISH=2}
{MEAT=633.3333333333334, OTHER=387.5, FISH=375.0}
testGroupingByFunctionAndSupplierAndCollector
class java.util.TreeMap
{MEAT=633.3333333333334, FISH=375.0, OTHER=387.5}
testSummarizingInt
IntSummaryStatistics{count=9, sum=4200, min=120, average=466.666667, max=800}

三、Collectors的API介绍和使用2  

GroupingByConcurrent;

joining;

mapping;

maxBy

代码举例如下:

 package com.cy.java8;

 import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.stream.Collectors;
import static com.cy.java8.CollectorsAction.menu; public class CollectorsAction2 { public static void main(String[] args) {
testGroupingByConcurrentWithFunction();
testGroupingByConcurrentWithFunctionAndCollector();
testGroupingByConcurrentWithFunctionAndSupplierAndCollector();
testJoining();
testMapping();
testMaxBy();
} /**
* 按食物类型分类
*/
private static void testGroupingByConcurrentWithFunction() {
System.out.println("testGroupingByConcurrentWithFunction");
ConcurrentMap<Dish.Type, List<Dish>> map = menu.stream().collect(Collectors.groupingByConcurrent(Dish::getType));
System.out.println(map.getClass());
System.out.println(map);
} /**
* 每类食物类型下面 卡路里平均值
*/
private static void testGroupingByConcurrentWithFunctionAndCollector() {
System.out.println("testGroupingByConcurrentWithFunctionAndCollector");
ConcurrentMap<Dish.Type, Double> map = menu.stream().collect(Collectors.groupingByConcurrent(Dish::getType, Collectors.averagingInt(Dish::getCalories)));
System.out.println(map);
} private static void testGroupingByConcurrentWithFunctionAndSupplierAndCollector() {
System.out.println("testGroupingByConcurrentWithFunctionAndCollector");
ConcurrentMap<Dish.Type, Double> map = menu.stream().collect(Collectors.groupingByConcurrent(Dish::getType, ConcurrentSkipListMap::new, Collectors.averagingInt(Dish::getCalories)));
System.out.println(map.getClass());
System.out.println(map);
} /**
* joining: 对stream里面的一些值进行连接
* 对食物的名字进行连接
*/
private static void testJoining() {
System.out.println("testJoining");
String s = menu.stream().map(Dish::getName).collect(Collectors.joining(",", "Names[", "]"));
System.out.println(s);
} /**
* 用一个mapping function在汇聚之前,将接受Dish的集合适用于接受DishName的集合
*/
private static void testMapping() {
System.out.println("testMapping");
String s = menu.stream().collect(Collectors.mapping(d -> d.getName(), Collectors.joining(",", "Names[", "]")));
System.out.println(s);
} /**
* 找出热量最大的食物
*/
private static void testMaxBy(){
System.out.println("testMaxBy");
Optional<Dish> maxCaloriesOptional = menu.stream().collect(Collectors.maxBy(Comparator.comparingInt(Dish::getCalories)));
maxCaloriesOptional.ifPresent(System.out::println);
} }

打印结果:

testGroupingByConcurrentWithFunction
class java.util.concurrent.ConcurrentHashMap
{FISH=[Dish{name='prawns', vegetarian=false, calories=300, type=FISH}, Dish{name='salmon', vegetarian=false, calories=450, type=FISH}], MEAT=[Dish{name='pork', vegetarian=false, calories=800, type=MEAT}, Dish{name='beef', vegetarian=false, calories=700, type=MEAT}, Dish{name='chicken', vegetarian=false, calories=400, type=MEAT}], OTHER=[Dish{name='french fries', vegetarian=true, calories=530, type=OTHER}, Dish{name='rice', vegetarian=true, calories=350, type=OTHER}, Dish{name='season fruit', vegetarian=true, calories=120, type=OTHER}, Dish{name='pizza', vegetarian=true, calories=550, type=OTHER}]}
testGroupingByConcurrentWithFunctionAndCollector
{FISH=375.0, MEAT=633.3333333333334, OTHER=387.5}
testGroupingByConcurrentWithFunctionAndCollector
class java.util.concurrent.ConcurrentSkipListMap
{MEAT=633.3333333333334, FISH=375.0, OTHER=387.5}
testJoining
Names[pork,beef,chicken,french fries,rice,season fruit,pizza,prawns,salmon]
testMapping
Names[pork,beef,chicken,french fries,rice,season fruit,pizza,prawns,salmon]
testMaxBy
Dish{name='pork', vegetarian=false, calories=800, type=MEAT}

四、Collectors的API介绍和使用3

partitioningBy

reduce

summarizingDouble

summarizingLong

summarizingInt

代码举例如下:

 package com.cy.java8;

 import java.util.*;
import java.util.function.BinaryOperator;
import java.util.stream.Collectors; import static com.cy.java8.CollectorsAction.menu; public class CollectorsAction3 { public static void main(String[] args) {
testPartitioningByWithPredicate();
testPartitioningByWithPredicateAndCollector();
testReducingBinaryOperator();
testReducingBinaryOperatorAndIdentity();
testReducingBinaryOperatorAndIdentityAndFunction();
testSummarizingDouble();
testSummarizingLong();
testSummarizingInt();
} /**
* 利用partitioningBy把menu中素食类和非素食类的分开
*/
private static void testPartitioningByWithPredicate() {
System.out.println("testPartitioningByPredicate");
Map<Boolean, List<Dish>> map = menu.stream().collect(Collectors.partitioningBy(Dish::isVegetarian));
System.out.println(map);
} /**
* 把素食类和非素食类分开,计算平均卡路里
*/
private static void testPartitioningByWithPredicateAndCollector() {
System.out.println("testPartitioningByWithPredicateAndCollector");
Map<Boolean, Double> map = menu.stream().collect(Collectors.partitioningBy(Dish::isVegetarian, Collectors.averagingInt(Dish::getCalories)));
System.out.println(map);
System.out.println(map.get(true));
} /**
* 找出menu中热量最大的dish
*/
private static void testReducingBinaryOperator() {
System.out.println("testReducingBinaryOperator");
//以前这么写
Optional<Dish> optional = menu.stream().reduce((dish1, dish2) -> dish1.getCalories() > dish2.getCalories() ? dish1 : dish2);
optional.ifPresent(System.out::println); //Collectors.reducing
Optional<Dish> optional2 = menu.stream().collect(Collectors.reducing(BinaryOperator.maxBy(Comparator.comparingInt(Dish::getCalories))));
optional2.ifPresent(System.out::println); Optional<Dish> optional3 = menu.stream().collect(Collectors.reducing((dish1, dish2) -> dish1.getCalories() > dish2.getCalories() ? dish1 : dish2));
optional3.ifPresent(System.out::println);
} /**
* 计算所有卡路里和
*/
private static void testReducingBinaryOperatorAndIdentity() {
System.out.println("testReducingBinaryOperatorAndIdentity");
//以前这么写
Integer totalCalories1 = menu.stream().map(Dish::getCalories).reduce(0, Integer::sum);
System.out.println(totalCalories1); //Collectors.reducing
Integer totalCalories2 = menu.stream().map(Dish::getCalories).collect(Collectors.reducing(0, Integer::sum));
System.out.println(totalCalories2);
} private static void testReducingBinaryOperatorAndIdentityAndFunction() {
System.out.println("testReducingBinaryOperatorAndIdentityAndFunction");
Integer result = menu.stream().collect(Collectors.reducing(0, Dish::getCalories, (d1, d2) -> d1 + d2));
System.out.println(result);
} private static void testSummarizingDouble(){
System.out.println("testSummarizingDouble");
DoubleSummaryStatistics result = menu.stream().collect(Collectors.summarizingDouble(Dish::getCalories));
System.out.println(result);
} private static void testSummarizingLong(){
System.out.println("testSummarizingLong");
LongSummaryStatistics result = menu.stream().collect(Collectors.summarizingLong(Dish::getCalories));
System.out.println(result);
} private static void testSummarizingInt(){
System.out.println("testSummarizingInt");
IntSummaryStatistics result = menu.stream().collect(Collectors.summarizingInt(Dish::getCalories));
System.out.println(result);
}
}

打印结果:

testPartitioningByPredicate
{false=[Dish{name='pork', vegetarian=false, calories=800, type=MEAT}, Dish{name='beef', vegetarian=false, calories=700, type=MEAT}, Dish{name='chicken', vegetarian=false, calories=400, type=MEAT}, Dish{name='prawns', vegetarian=false, calories=300, type=FISH}, Dish{name='salmon', vegetarian=false, calories=450, type=FISH}], true=[Dish{name='french fries', vegetarian=true, calories=530, type=OTHER}, Dish{name='rice', vegetarian=true, calories=350, type=OTHER}, Dish{name='season fruit', vegetarian=true, calories=120, type=OTHER}, Dish{name='pizza', vegetarian=true, calories=550, type=OTHER}]}
testPartitioningByWithPredicateAndCollector
{false=530.0, true=387.5}
387.5
testReducingBinaryOperator
Dish{name='pork', vegetarian=false, calories=800, type=MEAT}
Dish{name='pork', vegetarian=false, calories=800, type=MEAT}
Dish{name='pork', vegetarian=false, calories=800, type=MEAT}
testReducingBinaryOperatorAndIdentity
4200
4200
testReducingBinaryOperatorAndIdentityAndFunction
4200
testSummarizingDouble
DoubleSummaryStatistics{count=9, sum=4200.000000, min=120.000000, average=466.666667, max=800.000000}
testSummarizingLong
LongSummaryStatistics{count=9, sum=4200, min=120, average=466.666667, max=800}
testSummarizingInt
IntSummaryStatistics{count=9, sum=4200, min=120, average=466.666667, max=800}

  

五、Collectors的API介绍和使用4

summingDouble

summingLong

summingInt

toCollection

toConcurrentMap

toMap

toList

toSet

代码举例如下:

 package com.cy.java8;

 import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.stream.Collectors;
import static com.cy.java8.CollectorsAction.menu; public class CollectorsAction4 { public static void main(String[] args) {
testSummingDouble();
testToCollection();
testToConcurrentMap();
testToConcurrentMapAndBinaryOperator();
testToConcurrentMapAndBinaryOperatorAndSupplier();
testToList();
testToSet();
} /**
* 计算卡路里总和
*/
private static void testSummingDouble(){
System.out.println("testSummingDouble--------------");
//以前的写法
double sum = menu.stream().map(Dish::getCalories).mapToDouble(Integer::doubleValue).sum();
System.out.println(sum); //Collectors.summingDouble
Double sum2 = menu.stream().collect(Collectors.summingDouble(Dish::getCalories));
System.out.println(sum2);
} private static void testToCollection(){
System.out.println("testToCollection--------------");
LinkedList<Dish> list = menu.stream().filter(dish -> dish.getCalories() > 600).collect(Collectors.toCollection(LinkedList::new));
System.out.println(list);
} private static void testToConcurrentMap(){
System.out.println("testToConcurrentMap--------------");
ConcurrentMap<String, Integer> map = menu.stream().filter(dish -> dish.getCalories() > 600).collect(Collectors.toConcurrentMap(d -> d.getName(), d -> d.getCalories()));
System.out.println(map);
} /**
* Type : total
* 将menu转化为,key是type,value是这个type下有多少个,这样的map
*/
private static void testToConcurrentMapAndBinaryOperator(){
System.out.println("testToConcurrentMapAndBinaryOperator--------------");
ConcurrentMap<Dish.Type, Integer> map = menu.stream().collect(Collectors.toConcurrentMap(Dish::getType, d -> 1, (v1, v2) -> v1 + v2));
System.out.println(map.getClass());
System.out.println(map);
} private static void testToConcurrentMapAndBinaryOperatorAndSupplier(){
System.out.println("testToConcurrentMapAndBinaryOperatorAndSupplier--------------");
ConcurrentSkipListMap<Dish.Type, Integer> map = menu.stream().collect(Collectors.toConcurrentMap(Dish::getType, d -> 1, (v1, v2) -> v1 + v2, ConcurrentSkipListMap::new));
System.out.println(map.getClass());
System.out.println(map);
} private static void testToList() {
System.out.println("testToList--------------");
List<Dish> list = menu.stream().filter(Dish::isVegetarian).collect(Collectors.toList());
System.out.println(list.getClass());
System.out.println(list);
} /**
* 返回值类型为集合HashSet,里面的值不能重复,根据hashCode和equals做的判断
*/
private static void testToSet() {
System.out.println("testToSet--------------");
Set<Dish> set = menu.stream().filter(Dish::isVegetarian).collect(Collectors.toSet());
System.out.println(set.getClass());
System.out.println(set);
} /**
* toMap : 略
* toMap 和上面的 toConcurrentMap用法是一样的,只不过返回的是HashMap
*/
}

打印结果:

testSummingDouble--------------
4200.0
4200.0
testToCollection--------------
[Dish{name='pork', vegetarian=false, calories=800, type=MEAT}, Dish{name='beef', vegetarian=false, calories=700, type=MEAT}]
testToConcurrentMap--------------
{beef=700, pork=800}
testToConcurrentMapAndBinaryOperator--------------
class java.util.concurrent.ConcurrentHashMap
{OTHER=4, FISH=2, MEAT=3}
testToConcurrentMapAndBinaryOperatorAndSupplier--------------
class java.util.concurrent.ConcurrentSkipListMap
{MEAT=3, FISH=2, OTHER=4}
testToList--------------
class java.util.ArrayList
[Dish{name='french fries', vegetarian=true, calories=530, type=OTHER}, Dish{name='rice', vegetarian=true, calories=350, type=OTHER}, Dish{name='season fruit', vegetarian=true, calories=120, type=OTHER}, Dish{name='pizza', vegetarian=true, calories=550, type=OTHER}]
testToSet--------------
class java.util.HashSet
[Dish{name='rice', vegetarian=true, calories=350, type=OTHER}, Dish{name='pizza', vegetarian=true, calories=550, type=OTHER}, Dish{name='season fruit', vegetarian=true, calories=120, type=OTHER}, Dish{name='french fries', vegetarian=true, calories=530, type=OTHER}]

  

-----

Collector的使用的更多相关文章

  1. The The Garbage-First (G1) collector since Oracle JDK 7 update 4 and later releases

    Refer to http://www.oracle.com/technetwork/tutorials/tutorials-1876574.html for detail. 一些内容复制到这儿 Th ...

  2. hdu 2602 Bone Collector(01背包)模板

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Bone Collector Time Limit: 2000/1000 MS (Java/Ot ...

  3. Jmeter plugin jp@gc - PerfMon Metrics Collector

    Jmeter由于是开源工具,所以目前有很多插件可以供使用,最简单的方法是先把Plugin Manager安装了 下载地址:https://jmeter-plugins.org/wiki/Plugins ...

  4. Spring AOP 开发中遇到问题:Caused by: java.lang.IllegalArgumentException: warning no match for this type name: com.xxx.collector.service.impl.XxxServiceImpl [Xlint:invalidAbsoluteTypeName]

    在网上找了很多,都不是我想要的,后来发现是我在springaop注解的时候 写错了类名导致的这个问题 @Pointcut("execution(* com.xxx.collector.ser ...

  5. HDU2639Bone Collector II[01背包第k优值]

    Bone Collector II Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  6. HDOJ 4336 Card Collector

    容斥原理+状压 Card Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  7. HDU 2602 Bone Collector WA谁来帮忙找找错

    Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collec ...

  8. Bone Collector(01背包)

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87125#problem/N 题目: Description Many year ...

  9. (三)CMS Collector

    有些资料中,为区别parallel collector ,将应用与gc并发成为并行,在接下来的文章中,仍称为并发. -XX:useConcMarkSweepGC,可以用于minor gc和major ...

  10. zabbix登陆问题:cannot allocate shared memory for collector

    问题说明:在一台zabbix被监控服务器上(64位centos6.8系统,64G内容)启动zabbix_agent,发现进程无法启动,10050端口没有起来! 启动zabbix_agent进程没有报错 ...

随机推荐

  1. Idea多模块工程创建——继承、聚合

    一.工程介绍 淘淘网上商城是一个综合性的B2C平台,类似京东商城.天猫商城.会员可以在商城浏览商品.下订单,以及参加各种活动. 管理员.运营可以在平台后台管理系统中管理商品.订单.会员等. 客服可以在 ...

  2. Web Api 接口测试工具:WebApiTestClient

    前言:这两天在整WebApi的服务,由于调用方是Android客户端,Android开发人员也不懂C#语法,API里面的接口也不能直接给他们看,没办法,只有整个详细一点的文档呗.由于接口个数有点多,每 ...

  3. .align 5 .MACRO .ENDM .word

    ARM的.align 5就是2的5次方对齐,也就是4字节对齐 .macro <name> {<arg_1} {,<arg_2>} … {,<arg_N>} 定 ...

  4. python基础练习题7

    1.创建Person类,属性有姓名.年龄.性别,创建方法personInfo,打印这个人的信息2.创建Student类,继承Person类,属性有学院college,班级class,重写父类perso ...

  5. Shiro(一)

    1 权限管理 1.1 什么是权限管理? 基本上涉及到用户参与的系统都要进行权限管理,权限管理属于系统安全的范畴,权限管理实现对用户访问权限的控制,按照安全规则或者安全策略控制用户可以访问而且只能访问自 ...

  6. rediscli命令

    一.rediscli xxx 发送命令 二.进入客户端后的命令

  7. Ubuntu中linux虚拟机全屏

    登录客户机操作系统.在虚拟机中装载CD驱动器启动终端,使用tar解压缩安装程序,然后执行vmware-insall.pl安装VMware Tools. 1.进入文件界面,找到左侧“设备”右击“安装VM ...

  8. 【NOIP2016提高A组模拟10.15】打膈膜

    题目 分析 贪心, 先将怪物按生命值从小到大排序(显然按这个顺序打是最优的) 枚举可以发对少次群体攻击, 首先将所有的群体攻击发出去, 然后一个一个怪物打,当当前怪物生命值大于2,如果还有魔法值就放重 ...

  9. Help library 安装arcobjects for .NET异常问题

    新建一个reg文件写入,也可以导出一个reg文件在上面重新写入. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID\{9DAA ...

  10. 如何用 Redis 统计独立用户访问量

    众所周至,拼多多的待遇也是高的可怕,在挖人方面也是不遗余力,对于一些工作3年的开发,稍微优秀一点的,都给到30K的Offer,当然,拼多多加班也是出名的,一周上6天班是常态,每天工作时间基本都是超过1 ...