Skip to content

Instantly share code, notes, and snippets.

View thiagolenz's full-sized avatar

Thiago Alexandre Lenz thiagolenz

View GitHub Profile
@thiagolenz
thiagolenz / RecursividadeBasico.kt
Created July 21, 2023 20:14
Exemplo Básico sobre recursividade
/**
==== ÁRVORE GENEALÓGICA ===
Vovô Eugênio
- Matheus
- Pedrinho
- Valentina
- Mariana
- Bruno
- Patricia
@thiagolenz
thiagolenz / ExampleMap.java
Created November 19, 2022 21:10
Api Java Collections
package masterdev;
import java.util.HashMap;
import java.util.Map;
public class ExemplosMap {
public static void main(String[] args) {
Map<Long, Pessoa> mapa = new HashMap<>();
Pessoa joao = new Pessoa(1L, "Joao");
<html>
<head>
<style>
.parent {
display: flex;
justify-content: center;
align-items: center;
background-color: darkgrey;
width: 400px;
height: 400px;
<html>
<head>
<style>
.parent {
display: flex;
background-color: darkgrey;
width: 400px;
height: 400px;
}
@thiagolenz
thiagolenz / PessoaAPIDTOService.java
Last active October 11, 2020 14:07
PessoaAPIDTOService
@Service
public class PessoaService {
@Autowired private PessoaRepository pessoaRepository;
@Autowired private EnderecoRepository enderecoRepository;
public PessoaDTO save (PessoaDTO pessoaDTO) {
Pessoa pessoa = convertFrom(pessoaDTO);
pessoaRepository.save (pessoa);
saveEndereco (pessoaDTO, pessoa);
@thiagolenz
thiagolenz / PessoaDTOEntityRefatorado.java
Last active October 11, 2020 13:58
PessoaDTOEntityRefatorado
@Entity
public class Pessoa {
@Id private Long id;
private String nome;
}
@Entity
public class Endereco {
@Id private Long id;
private Long pessoaId;
@thiagolenz
thiagolenz / PessoaDTOAPI.java
Last active October 11, 2020 13:33
PessoaDTOAPI
public class PessoaDTO {
private Long id;
private String nome;
// dados do endereco
private String rua;
private String numero;
private String bairro;
private String cep;
private String cidade;
@thiagolenz
thiagolenz / Pessoa.java
Last active October 11, 2020 13:15
Pessoa.java
@Entity
public class Pessoa {
@Id private Long id;
private String nome;
// dados do endereco
private String rua;
private String numero;
private String bairro;
private String cep;
@thiagolenz
thiagolenz / Mainzinho.kt
Last active August 22, 2020 14:04
Combinações de Senhas com pares de números
import java.lang.StringBuilder
fun main() {
val pairs = mutableListOf<Pair<Int, Int>>()
pairs.add(Pair(0, 9))
pairs.add(Pair(7, 4))
pairs.add(Pair(5, 2))
pairs.add(Pair(8, 1))
pairs.add(Pair(3,6))
public interface Identificacao {
String getCnpj();
Integer getPeriodo();
static Identificacao of(final String cnpj, final Integer periodo) {
return new Identificacao () {
public String getCnpj() {
return cnpj;
}
public Integer getPeriodo() {