congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
QPair
Code IndexAdd Tabnine to your IDE (free)

How to use
QPair
in
com.mysema.query.group

Best Java code snippets using com.mysema.query.group.QPair (Showing top 13 results out of 315)

origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing TreeMap using the given comparator
 *
 * @param key
 * @param value
 * @param comparator
 * @return
 */
public static <K, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value, Comparator<? super K> comparator) {
  return GMap.createSorted(QPair.create(key, value), comparator);
}
origin: com.mysema.querydsl/querydsl-core

public static <K, V> QPair<K, V> create(Expression<K> key, Expression<V> value) {
  return new QPair<K, V>(key, value);
}

origin: com.mysema.querydsl/querydsl-core

@Override
public <K, V> SortedMap<K, V> getSortedMap(Expression<K> key, Expression<V> value) {
  for (QPair<?, ?> pair : maps) {
    if (pair.equals(key, value)) {
      return (SortedMap<K, V>) groupCollectorMap.get(pair).get();
    }
  }
  throw new NoSuchElementException("GMap(" + key + ", " + value + ")");
}
origin: com.mysema.querydsl/querydsl-core

public boolean equals(Expression<?> keyExpr, Expression<?> valueExpr) {
  return getArgs().get(0).equals(keyExpr) && getArgs().get(1).equals(valueExpr);
}

origin: com.mysema.querydsl/querydsl-core

public boolean equals(Expression<?> keyExpr, Class<?> valueType) {
  return getArgs().get(0).equals(keyExpr) && valueType.isAssignableFrom(getArgs().get(1).getType());
}

origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing TreeMap
 *
 * @param key
 * @param value
 * @return
 */
public static <K extends Comparable<? super K>, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value) {
  return GMap.createSorted(QPair.create(key, value));
}
origin: com.mysema.querydsl/querydsl-core

@Override
@SuppressWarnings("unchecked")
public <K, V> Map<K, V> getMap(Expression<K> key, Expression<V> value) {
  for (QPair<?, ?> pair : maps) {
    if (pair.equals(key, value)) {
      return (Map<K, V>) groupCollectorMap.get(pair).get();
    }
  }
  throw new NoSuchElementException("GMap(" + key + ", " + value + ")");
}
origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing LinkedHashMap
 *
 * @param key
 * @param value
 * @return
 */
public static <K, V, T, U> AbstractGroupExpression<Pair<K, V>, Map<T, U>> map(GroupExpression<K, T> key, GroupExpression<V, U> value) {
  return new GMap.Mixin<K, V, T, U, Map<T, U>>(key, value, GMap.createLinked(QPair.create(key, value)));
}
origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing TreeMap
 *
 * @param key
 * @param value
 * @return
 */
public static <K extends Comparable<? super K>, V, T extends Comparable<? super T>, U> AbstractGroupExpression<Pair<K, V>, SortedMap<T, U>> sortedMap(GroupExpression<K, T> key, GroupExpression<V, U> value) {
  return new GMap.Mixin<K, V, T, U, SortedMap<T, U>>(key, value, GMap.createSorted(QPair.create(key, value)));
}
origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing LinkedHashMap
 *
 * @param key
 * @param value
 * @return
 */
@WithBridgeMethods(value=Expression.class,castRequired=true)
public static <K, V> AbstractGroupExpression<Pair<K, V>,Map<K, V>> map(Expression<K> key, Expression<V> value) {
  return GMap.createLinked(QPair.create(key, value));
}
origin: com.mysema.querydsl/querydsl-core

/**
 * Create a new aggregating map expression using a backing TreeMap using the given comparator
 *
 * @param key
 * @param value
 * @param comparator
 * @return
 */
public static <K, V, T, U> AbstractGroupExpression<Pair<K, V>, SortedMap<T, U>> sortedMap(GroupExpression<K, T> key, GroupExpression<V, U> value, Comparator<? super T> comparator) {
  return new GMap.Mixin<K, V, T, U, SortedMap<T, U>>(key, value, GMap.createSorted(QPair.create(key, value), comparator));
}
origin: com.mysema.querydsl/querydsl-core

@SuppressWarnings({ "rawtypes", "unchecked" })
public Mixin(GroupExpression<K, T> keyExpression, GroupExpression<V, U> valueExpression, AbstractGroupExpression<Pair<T, U>, R> mixin) {
  super((Class) mixin.getType(), QPair.create(keyExpression.getExpression(), valueExpression.getExpression()));
  this.keyExpression = keyExpression;
  this.valueExpression = valueExpression;
  this.mixin = mixin;
}
origin: com.mysema.querydsl/querydsl-jpa

@Test
@ExcludeIn({MYSQL, DERBY})
@NoBatooJPA
public void GroupBy() {
  QAuthor author = QAuthor.author;
  QBook book = QBook.book;
  for (int i = 0; i < 10; i++) {
    Author a = new Author();
    a.setName(String.valueOf(i));
    save(a);
    for (int j = 0; j < 2; j++) {
      Book b = new Book();
      b.setTitle(String.valueOf(i)+" "+String.valueOf(j));
      b.setAuthor(a);
      save(b);
    }
  }
  Map<Long, List<Pair<Long, String>>> map = query()
    .from(author)
    .join(author.books, book)
    .transform(GroupBy
      .groupBy(author.id)
      .as(GroupBy.list(QPair.create(book.id, book.title))));
  for (Entry<Long, List<Pair<Long, String>>> entry : map.entrySet()) {
    System.out.println("author = " + entry.getKey());
    for (Pair<Long,String> pair : entry.getValue()) {
      System.out.println("  book = " + pair.getFirst() + "," + pair.getSecond());
    }
  }
}
com.mysema.query.groupQPair

Javadoc

A pair of (Map) key and value

Most used methods

  • create
  • <init>
  • equals
  • getArgs

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • getSystemService (Context)
  • setContentView (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JOptionPane (javax.swing)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now