- 1
Class HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
Class HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
https://javadoc.io/doc/org.aspectj/aspectjweaver/1.8.10/org/aspectj/weaver/patterns/HasThisTypePatternTriedToSneakInSomeGene ricOrParameterizedTypePatternMatchingStu ffAnywhereVisitor.html
+1
.
https://vc.ru/flood/149783-podgotovte-nomer-pablik-steytik-dzhava-tochka-pomoshchnik-oleg-zachital-sboy-vo-vremya-testa-v-koll-centre-tinkoff
0
{
"error": false,
"message": "Ok",
"data": {
"countries": [
{
"country": {
"id": 24,
"iso_a2": "CA",
"name": "Canada",
"prefix": "1",
"vendors": [
1
]
},
"city": {
"id": 3723,
"region_id": 8,
"name": "Toronto",
"prefix": "416",
"icon_url": null,
"setup": 0.25,
"monthly": 1.88
}
},
{
"country": {
"id": 51,
"iso_a2": "IL",
"name": "Israel",
"prefix": "972",
"vendors": [
1
]
},
"city": {
"id": 122,
"region_id": null,
"name": "Jerusalem",
"prefix": "2",
"icon_url": null,
"setup": 0.25,
"monthly": 1.88
}
},
{
"country": {
"id": 94,
"iso_a2": "GB",
"name": "United Kingdom",
"prefix": "44",
"vendors": [
1
]
},
"city": {
"id": 4701,
"region_id": null,
"name": "London",
"prefix": "207",
"icon_url": null,
"setup": 0.25,
"monthly": 1.88
}
},
{
"country": {
"id": 95,
"iso_a2": "US",
"name": "United States",
"prefix": "1",
"vendors": [
1,
2
]
},
"city": {
"id": 6400,
"region_id": 44,
"name": "New York",
"prefix": "332",
"icon_url": null,
"setup": 0.25,
"monthly": 1.88
}
}
]
}
}
CTO написал апишечку для возврата доступных локейшнов по странам для покупки телефонных номеров
изыск 2021 я такого и в 2000ых не встречал !!!
−2
This would raise the true nightmare. A type variable is a different beast than the actual type of a concrete instance.
A type variable could resolve to a, e.g. ? extends Comparator<? super Number> to name one (rather simple) example.
Providing the necessary meta information would imply that not only object allocation becomes much more expensive,
every single method invocation could impose these additional cost, to an even bigger extend as we are now not only
talking about the combination of generic classes with actual classes, but also every possible wildcarded combination,
even of nested generic types.
https://stackoverflow.com/a/38060012
Джавист-долбоеб с пеной у рта защищает type erasure, задавая вопросы "Does it [c#] have an equivalent of Function.identity()? " в комментариях и собирая плюсы таких же поехавших.
В качестве аргументов он предлагает:
1) сложна
2) хранить информацию о типах в рантайме означает что в рантайме придется хранить информацию о типах!!!
3) [s]ма-те-ма-ти-ка[/x] реф-лек-си-я
Причем ведь наверняка знает и про темплейты в крестах, и про то что шарп такой хуйней не страдает.
0
package java.util;
public final class Optional<T> {
public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
Objects.requireNonNull(mapper);
if (!isPresent())
return empty();
else {
return Optional.ofNullable(mapper.apply(value));
}
}
}
Они не только не знают, что else после if не нужен и лишь привносит лишний нестинг, они даже единый стиль расставления фигурных скобок выдержать не могут
+2
package java.nio.file;
public final class Files {
/**
* Convert a Closeable to a Runnable by converting checked IOException
* to UncheckedIOException
*/
private static Runnable asUncheckedRunnable(Closeable c) {
return () -> {
try {
c.close();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
};
}
}
стандартные потрошки джавы это какая-то запредельная протомразь, нарушающая собственные законы физики и запрещающая делать это другим
0
var io = java.io
var BufferedReader = io.BufferedReader
var BufferedWriter = io.BufferedWriter
var InputStreamReader = io.InputStreamReader
var OutputStreamWriter = io.OutputStreamWriter
var Socket = java.net.Socket
var socket = new Socket("localhost", 5050)
var input = new BufferedReader(new InputStreamReader(socket.getInputStream()))
var output = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
while(true){
var data = input.readLine()
console.log(data)
}
Один петух написал мне в три часа ночи с прозьбой помочь с кодом
0
final class Point {
public final int x;
public final int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
// state-based implementations of equals, hashCode, toString
// nothing else
}
is "just" the data (x, y). Its representation is (x, y), its construction protocol accepts an (x, y) pair and stores it directly into the representation,
it provides unmediated access to that representation, and derives the core Object methods directly from that representation.
And in the middle, there are grey areas where we're going to have to draw a line.
Other OO languages have explored compact syntactic forms for modeling data-oriented classes: case classes in Scala, data classes in Kotlin, and record classes in C#.
These have in common that some or all of the state of a class can be described directly in the class header -- though they vary in their semantics
(such as constraints on the mutability or accessibility of fields, extensibility of the class, and other restrictions.)
Committing in the class declaration to at least part of the relationship between state and interface enables suitable defaults to be derived for many common members.
All of these mechanisms (let's call them "data classes") seek to bring us closer to the goal of being able to define Point as something like:
record Point(int x, int y) { }
[u]https://openjdk.java.net/jeps/359
https://cr.openjdk.java.net/~briangoetz/amber/datum.html[u]
+1
[code]
lengthMapping.put("pt", Float.valueOf(1f));
// Not sure about 1.3, determined by experiementation.
lengthMapping.put("px", Float.valueOf(1.3f));
lengthMapping.put("mm", Float.valueOf(2.83464f));
lengthMapping.put("cm", Float.valueOf(28.3464f));
lengthMapping.put("pc", Float.valueOf(12f));
lengthMapping.put("in", Float.valueOf(72f));
[/code]
+1
public static <T> Comparator<T> reverseOrder(Comparator<T> cmp) {
if (cmp == null)
return reverseOrder();
if (cmp instanceof ReverseComparator2)
return ((ReverseComparator2<T>)cmp).cmp;
return new ReverseComparator2<>(cmp);
}
кишки стандартной библиотеки йажи продолжают радовать, хорошо хоть нет ReverseComparatorFinal или ReverseComparatorBassBoostedByKirillXXL