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 com.google.gson.Gson; | |
import com.google.gson.reflect.TypeToken; | |
import java.lang.reflect.Type; | |
import java.util.List; | |
public class NullSer { | |
public static void main(String[] args) { | |
String json = "[{\n" + | |
" \"id\":\"1\",\n" + |
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 com.google.gson.*; | |
import com.google.gson.annotations.SerializedName; | |
import com.google.gson.stream.JsonReader; | |
import com.google.gson.stream.JsonWriter; | |
import java.io.IOException; | |
import java.lang.reflect.Type; | |
import java.util.*; | |
import java.util.stream.Collectors; |
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 java.util.*; | |
import java.util.function.BiPredicate; | |
import java.util.function.Consumer; | |
import java.util.stream.Stream; | |
import java.util.stream.StreamSupport; | |
public class Stuff { | |
public static void main(String[] args) { | |
Stream<Integer> input = Stream.of(1, 1, 1, 2, 2, 2, 3, 6, 7, 7, 1, 1); |
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
public class RS { | |
public static void main(String[] args) throws FileNotFoundException { | |
Type t = new TypeToken<List<RateInfo>>(){}.getType(); | |
Gson gson = new GsonBuilder().registerTypeAdapter(t, new RSDeserializer()).create(); | |
TopLevel topLevel = gson.fromJson(new FileReader(new File("test.json")), TopLevel.class); | |
System.out.println(topLevel); | |
} | |
} |
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 com.google.gson.*; | |
import com.google.gson.reflect.TypeToken; | |
import java.lang.reflect.Type; | |
import java.util.*; | |
public class MapToJson { | |
public static void main(String[] args) { | |
Map<Wrapper ,Boolean> map = new HashMap<>(); | |
map.put(new Wrapper(new String[]{"Hello"}),false); | |
map.put(new Wrapper(new String[]{"Stack", "Overflow"}), true); |
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 com.google.gson.*; | |
import com.google.gson.reflect.TypeToken; | |
import com.google.gson.stream.JsonReader; | |
import com.google.gson.stream.JsonWriter; | |
import java.io.*; | |
import java.lang.reflect.Type; | |
import java.util.*; | |
public class Parsing { |
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 java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.*; | |
import java.util.function.Predicate; | |
import java.util.stream.Stream; | |
import static java.util.stream.Collectors.*; | |
public class Stats { |
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 com.google.gson.*; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
public class Json { | |
public static void main(String... args) throws FileNotFoundException { | |
Gson gson = new Gson(); |
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 com.google.gson.*; | |
import com.google.gson.annotations.SerializedName; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.lang.reflect.Type; | |
import java.util.Collection; | |
/** |
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 java.util.*; | |
import static java.util.stream.Collectors.*; | |
import java.util.stream.Stream; | |
/** | |
* Created by alex on 23.02.15. | |
*/ | |
public class MessagesQuery { | |
public static void main(String... args) { | |
Collection<Message> myCombinedCollection = getList(); |
NewerOlder