我有以下java类:
public class Customer {
private long id;
public long getId() {
return id;
}
}
Run Code Online (Sandbox Code Playgroud)
我也有一个List<Customer> customers
.Customer.getId()
使用lambda表达式对列表进行排序的最优雅方法是什么?
现在我有这个代码:
Comparator<Customer> customerComparator = (previousCustomer, nextCustomer) ->
Long.compare(previousCustomer.getId(), nextCustomer.getId());
customers.sort(customerComparator);
Run Code Online (Sandbox Code Playgroud)
但是,如果我需要为每个不同的排序或每个不同的通用列表编写比较器,它会感到笨拙.可以用一行代码完成吗?
我刚刚开始学习Docker,大多数教程都是从以下开始的: docker run -t -i ubuntu /bin/bash
我无法使用它 docker run ubuntu /bin/bash
我能错过什么?
root@njain2:~# docker run -t -i ubuntu /bin/bash
docker - version 1.4
Copyright 2003, Ben Jansens <ben@orodu.net>
Usage: docker [OPTIONS]
Options:
-help Show this help.
-display DISPLAY The X display to connect to.
-border The width of the border to put around the
system tray icons. Defaults to 1.
-vertical Line up the icons vertically. Defaults to
horizontally.
-wmaker WindowMaker mode. This makes docker a
fixed size (64x64) …
Run Code Online (Sandbox Code Playgroud)