- JPA ou Hibernate?
- JPA deu origem ao Hibernate. Hibernate é uma implementação de JPA
- Existe um mundo onde JDBC puro é mais utilizado?
- Eu uso bastante JDBC puro. Normalmente se usa quando se precisa falar diretamente com o banco, não HQL ou coisa equivalente. Existem tretas com spring-jdbc que o jdbc puro trata bem. Não cheguei a usar algo mais específico do spring para stream de dados e coisas mais pesadas.
- Existe algum Query Builder no mundo Java?
- Muitos. Como exemplo, jOOQ.
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
data Nat = Zero | Suc Nat | |
inc :: Nat -> Nat | |
inc x = Suc x | |
showNat :: Nat -> String | |
showNat Zero = "Zero" | |
showNat (Suc v) = "Suc " ++ (show v) | |
type BinNat = (Nat -> Nat -> Nat) |
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.io.InputStream; | |
import java.util.Iterator; | |
import java.util.function.Function; | |
public class ServeInputStream<T> extends InputStream { | |
private final Iterator<T> iterator; | |
private final Function<T, byte[]> serializer; |
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
data Resultado = Vazio | Valor Integer | |
type Mapeamento = (Integer -> Resultado) | |
showResultado :: Resultado -> String | |
showResultado Vazio = "Vazio" | |
showResultado (Valor v) = "Valor " ++ (show v) | |
instance Show Resultado where | |
show = showResultado |
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
<html> | |
<head> | |
<script defer="" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous"> | |
</head> | |
<body> | |
<p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">∀</mi><mi>i</mi><mo>∈</mo><mrow><mo fence="true">(</mo><mn>0</mn><mo separator="true">,</mo><mrow><mo fence="true">∣</mo><mi>P</mi><mo fence="true">∣</mo></mrow><mo fence="true">]</mo></mrow><mo>:</mo><msub><mi>p</mi><mrow><mi>i</mi><mo>−</mo><mn>1</mn></mrow></msub><mi mathvariant="normal">.</mi><msub><mi>v</mi><mrow><mi>i</mi><mi>n</mi></mrow></msub><mo>=</mo><msub><mi>p</mi><mi>i</mi></msub><mi mathvari |
Um pequeno exercício Java para trabalhar modelagem de dados.
Você precisa saber se o SLA de atendimento está sendo atendido e, se não está, quantos pacientes na fila foram atendidos depois do SLA.
Você receberá um único array de EVENTOS, ordenado pela ordem cornológica de acontecimento. Cada evento contém as seguintes informações:
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.Arrays; | |
import java.util.stream.Collector; | |
class SegundoMenor { | |
static class AB { | |
int a, b; | |
boolean primeiro; | |
boolean segundo; |
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.stream.Collectors; | |
import java.util.stream.Stream; | |
public class LongestCommonPrefix { | |
static final Holder FIRST_HOLDER = new Holder("", 0) { | |
@Override | |
Holder acc(String another) { | |
return another.isEmpty()? EMPTY_HOLDER: new Holder(another); | |
} | |
@Override |
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.time.Instant; | |
import static java.time.temporal.ChronoUnit.*; | |
class Domingos { | |
public static void main(String... args) { | |
Instant x1 = Instant.now(); | |
int deltaMes[] = { | |
31, // jan 1 | |
28, // fev 1 | |
31, // mar 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
import java.math.BigDecimal; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
public class DesafioSemLoop { | |
public static BigDecimal totalCompras(List<Compra> compras) { | |
//TODO implementar a soma sem usar loops while, for, do-while... |
NewerOlder