添加tag
This commit is contained in:
@@ -4,8 +4,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -17,22 +20,62 @@ import java.time.Instant;
|
||||
@Data
|
||||
public class CarryCapcityData {
|
||||
|
||||
@Column(name = "time")
|
||||
@Column(name = "time",tag = true)
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@Column(name = "line_id",tag = true)
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "phasic_type")
|
||||
@Column(name = "phasic_type",tag = true)
|
||||
private String phaseType;
|
||||
|
||||
@Column(name = "quality_flag")
|
||||
private String qualityFlag;
|
||||
|
||||
@Column(name = "value_type")
|
||||
@Column(name = "value_type",tag = true)
|
||||
private String valueType;
|
||||
|
||||
private Double value;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String[] strs ={"eat","tea", "tan", "ate", "nat", "bat"};
|
||||
|
||||
CarryCapcityData.groupAnagrams(strs);
|
||||
}
|
||||
|
||||
public static List<List<String>> groupAnagrams(String[] strs) {
|
||||
Map<String, List<String>> collect = Arrays.stream(strs).collect(Collectors.groupingBy(temp -> {
|
||||
char[] charArray = temp.toCharArray();
|
||||
Arrays.sort(charArray);
|
||||
return new String(charArray);
|
||||
}));
|
||||
return new ArrayList<>(collect.values());
|
||||
|
||||
}
|
||||
|
||||
public int longestConsecutive(int[] nums) {
|
||||
Set<Integer> num_set = new HashSet<>();
|
||||
for (int num : nums) {
|
||||
num_set.add(num);
|
||||
}
|
||||
int longestStreak = 0;
|
||||
for (int num:
|
||||
num_set) {
|
||||
if (!num_set.contains(num - 1)) {
|
||||
int currentNum = num;
|
||||
int currentStreak = 1;
|
||||
|
||||
while (num_set.contains(currentNum + 1)) {
|
||||
currentNum += 1;
|
||||
currentStreak += 1;
|
||||
}
|
||||
|
||||
longestStreak = Math.max(longestStreak, currentStreak);
|
||||
}
|
||||
}
|
||||
return longestStreak;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user