<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[呈凹的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/changshu1</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; changshu1]]></copyright><item><title><![CDATA[使用左连接和右连接代替全连接 3 （3 张表，值不唯一）（4张表）（统一结论）]]></title><link>https://blog.csdn.net/changshu1/article/details/103404956</link><guid>https://blog.csdn.net/changshu1/article/details/103404956</guid><author>changshu1</author><pubDate>Thu, 05 Dec 2019 16:32:29 +0800</pubDate><description><![CDATA[在前两篇文章中，我们都是使用的 2 张表，如果是 3 张表，结论会不会变呢？我们来试一下。

3. 3张表，值不唯一的情况。

3.1 创建测试用表。



DROP TABLE IF EXISTS table1;

CREATE TABLE table1
(
    column_1 NUMERIC
);

INSERT INTO table1
VALUES (123);
INSERT INT...]]></description><category></category></item><item><title><![CDATA[使用左连接和右连接代替全连接 2 （2 张表，值不唯一）]]></title><link>https://blog.csdn.net/changshu1/article/details/103390878</link><guid>https://blog.csdn.net/changshu1/article/details/103390878</guid><author>changshu1</author><pubDate>Thu, 05 Dec 2019 14:43:04 +0800</pubDate><description><![CDATA[在上篇文章中，我们的测试用表，没一行都是唯一的，也就是没有重复值，如果有重复值，结论会不会变呢？

2. 2 张表，值不唯的情况。

2.1 创建测试用表。



DROP TABLE IF EXISTS table1;

DROP TABLE IF EXISTS table2;

CREATE TABLE table1
(
    column_1 NUMERIC
);

INSERT ...]]></description><category></category></item><item><title><![CDATA[使用左连接和右连接代替全连接 1 （2 张表，值唯一）]]></title><link>https://blog.csdn.net/changshu1/article/details/103389347</link><guid>https://blog.csdn.net/changshu1/article/details/103389347</guid><author>changshu1</author><pubDate>Wed, 04 Dec 2019 17:27:05 +0800</pubDate><description><![CDATA[MySQL 不支持 FULL OUTER JOIN，如果需要使用 FULL OUTER JOIN，可以使用 LEFT OUTER JOIN 和 RIGHT OUTER JOIN 来模拟。这篇文章研究怎样使用 LEFT OUTER JOIN 和 RIGHT OUTER JOIN 代替 FULL OUTER JOIN。

  因为 PostgreSQL 支持 FULL OUTER JOIN...]]></description><category></category></item><item><title><![CDATA[MySQL 和 PostgreSQL 字符串类型比较]]></title><link>https://blog.csdn.net/changshu1/article/details/102626050</link><guid>https://blog.csdn.net/changshu1/article/details/102626050</guid><author>changshu1</author><pubDate>Fri, 18 Oct 2019 19:33:52 +0800</pubDate><description><![CDATA[1. MySQL：

  1.1 CHAR(n)

    1.1. 存储固定长度（n）的字符串。n 范围是 [0, 255]。n 的缺省值为 1.

    1.2. 当插入的字符串长度小于 n 时，MySQL 会在末尾补充空格。查询的时候，MySQL 会删除末尾的空格（不会删除头部空格）。

    1.3. MySQL 在处理 &gt;、 &gt;=、 &lt;、...]]></description><category></category></item><item><title><![CDATA[ConcurrentHashMap]]></title><link>https://blog.csdn.net/changshu1/article/details/102590009</link><guid>https://blog.csdn.net/changshu1/article/details/102590009</guid><author>changshu1</author><pubDate>Wed, 16 Oct 2019 19:29:07 +0800</pubDate><description><![CDATA[ConcurrentHashMap 在功能上与 HashTable 一致，都是线程安全的键值对容器。但是 ConcurrentHashMap比 HashTable 有更好的并发性能：

1. HashTable 是同步的，也就是说，它的所有方法都是被 synchronized 修饰的。所以当 thread-1 进入put 方法时，其它所有线程都不能进入put/get 方法。这样做可以确保线程...]]></description><category></category></item><item><title><![CDATA[Collections.synchronizedXxx]]></title><link>https://blog.csdn.net/changshu1/article/details/102525655</link><guid>https://blog.csdn.net/changshu1/article/details/102525655</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 19:06:40 +0800</pubDate><description><![CDATA[先来看一下集合类：



                     表 1 . Java Collection Implementations

以上 10 个Java 集合的实现类搜不是同步的。（类/成员函数/代码块 没有使用 synchronized 修饰）

可以通过Collections.synchronizedXxx 来把他们变成同步的。比如...]]></description><category></category></item><item><title><![CDATA[LinkedHashMap]]></title><link>https://blog.csdn.net/changshu1/article/details/102525290</link><guid>https://blog.csdn.net/changshu1/article/details/102525290</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 18:36:55 +0800</pubDate><description><![CDATA[LinkedHashMap 继承自 HashMap，与HashMap 相比，增加了一个功能：每个节点使用双向链表链接起来，这样就能保证节点的遍历顺序与插入顺序一致。

这是 HashMap 的节点：


  static class Node&lt;K,V&gt; implements Map.Entry&lt;K,V&gt; {
    final int hash;
   ...]]></description><category></category></item><item><title><![CDATA[TreeMap]]></title><link>https://blog.csdn.net/changshu1/article/details/102524635</link><guid>https://blog.csdn.net/changshu1/article/details/102524635</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 18:03:52 +0800</pubDate><description><![CDATA[TreeMap 通过红黑树实现，一般的读写操作都是 log(n) 的时间复杂度： containsKey，get，put，remove。

来看一下 put 函数的源码：


  public V put(K key, V value) {
    Entry&lt;K,V&gt; t = root;
    if (t == null) {
      c...]]></description><category></category></item><item><title><![CDATA[NavigableMap]]></title><link>https://blog.csdn.net/changshu1/article/details/102521061</link><guid>https://blog.csdn.net/changshu1/article/details/102521061</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 15:20:25 +0800</pubDate><description><![CDATA[1. NavigableMap 继承自 SortedMap，所以它的元素是有序的。

2. 在 SortedMap 基础上，支持快速搜索符合条件的最近的元素。这里条件主要是指lower(&gt;),floor(&gt;=)，ceiling(&lt;)，higher(&gt;)。

3. 支持逆序访问。descendingKeySet /descendingMap。

4. 支持获取子集合...]]></description><category></category></item><item><title><![CDATA[RandomAccess]]></title><link>https://blog.csdn.net/changshu1/article/details/102520393</link><guid>https://blog.csdn.net/changshu1/article/details/102520393</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 14:47:41 +0800</pubDate><description><![CDATA[RandomAccess 只是一个标记，继承这个接口的类，支持快速随机访问（时间复杂度为O(1)）。

一些通用算法，可以根据这个接口，知道相应的类支持随机访问还是顺序访问，根据这个信息来提升算法的性能。



参考链接：

1.https://docs.oracle.com/javase/8/docs/api/java/util/RandomAccess.html
...]]></description><category></category></item><item><title><![CDATA[NavigableSet]]></title><link>https://blog.csdn.net/changshu1/article/details/102518140</link><guid>https://blog.csdn.net/changshu1/article/details/102518140</guid><author>changshu1</author><pubDate>Sat, 12 Oct 2019 12:34:43 +0800</pubDate><description><![CDATA[NavigableSet 继承自 SortedSet，相比于 SortedSet，NavigableSet 多了以下几类功能：

1. 直接获取符合条件的最近的元素，这里，条件主要是 lower(&gt;)、 floor(&gt;=)、 higher(&lt;)、 ceiling(&lt;=)。如果符合条件的元素不存在，就返回 null。

2. 逆向访问：descendingSet，descen...]]></description><category></category></item><item><title><![CDATA[HashMap]]></title><link>https://blog.csdn.net/changshu1/article/details/101783246</link><guid>https://blog.csdn.net/changshu1/article/details/101783246</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 18:13:39 +0800</pubDate><description><![CDATA[我们通过查看 put 方法的源码，来比较 HashMap 和 HashTable 的区别：


  public V put(K key, V value) {
    return putVal(hash(key), key, value, false, true); // value 可以为 null
  }
  static final int hash(Object k...]]></description><category></category></item><item><title><![CDATA[HashTable]]></title><link>https://blog.csdn.net/changshu1/article/details/101781160</link><guid>https://blog.csdn.net/changshu1/article/details/101781160</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 17:47:26 +0800</pubDate><description><![CDATA[Map 接口中，key 和 value 都可以为 null。

HashTable 实现中，key 和 value 都不允许为 null。

我们看一下它添加元素的方法：


  public synchronized V put(K key, V value) {
    if (value == null) { // value 不能为 null
      throw...]]></description><category></category></item><item><title><![CDATA[Map]]></title><link>https://blog.csdn.net/changshu1/article/details/101780495</link><guid>https://blog.csdn.net/changshu1/article/details/101780495</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 17:07:27 +0800</pubDate><description><![CDATA[Map 没有继承 Collection，因为 Map 是键值对的集合，而 Collection 仅仅是值的集合。

Map 要求键必须唯一。

Map 的主要实现有：HashTable，HashMap，LinkedHashMap，IdentityHashMap，WeakHaspMap。



参考链接：

1.https://docs.oracle.com/javase/8/docs/api/...]]></description><category></category></item><item><title><![CDATA[TreeSet]]></title><link>https://blog.csdn.net/changshu1/article/details/101777442</link><guid>https://blog.csdn.net/changshu1/article/details/101777442</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 16:35:40 +0800</pubDate><description><![CDATA[HashSet 是通过 HashMap 实现的。

LinkedSet 是通过 LinkedHaspMap 实现的。

果然，TreeSet 是通过 TreeMap 来实现的。

我们来看一下 TreeSet 的 add 方法的实现：


  public boolean add(E e) {
    return m.put(e, PRESENT)==null;
  }
  ...]]></description><category></category></item><item><title><![CDATA[SortedSet]]></title><link>https://blog.csdn.net/changshu1/article/details/101776445</link><guid>https://blog.csdn.net/changshu1/article/details/101776445</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 16:07:29 +0800</pubDate><description><![CDATA[SortedSet 是一个接口，它继承自 Set。比 Set 多的功能是，它保证元素按照大小排序。因为这个特点，所有它有 first(), last() 这样的成员函数。

需要区分的是，LinkedHashSet 保证元素的顺序，是保证插入顺序与遍历顺序一只。而SortedSet 保证的顺序是指遍历顺序始终是按照从小到大排序。当然了，也可以自定义比较函数，让它按照从大到小排序。



参考链接...]]></description><category></category></item><item><title><![CDATA[LinkedHashSet]]></title><link>https://blog.csdn.net/changshu1/article/details/101775649</link><guid>https://blog.csdn.net/changshu1/article/details/101775649</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 15:49:58 +0800</pubDate><description><![CDATA[继承自 HashSet，不过比 HashSet 多的功能是它维护了一份双向链表，来将它所有的元素连接起来。遍历的顺序与插入的顺序是一致的。HashSet 不能保证这样的一致性。

看 LinkedHashSet 的源码，发现 LinkedHashSet 没有自己的方法，只有一些构造方法：


  public LinkedHashSet(int initialCapacity, float l...]]></description><category></category></item><item><title><![CDATA[HashSet]]></title><link>https://blog.csdn.net/changshu1/article/details/101763485</link><guid>https://blog.csdn.net/changshu1/article/details/101763485</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 15:18:29 +0800</pubDate><description><![CDATA[HashSet，顾名思义，我们可以得到两点信息：

1. 实现了 Set 接口。

2. 通过 Hash 表实现。所以它的 element 是无序的。

下面看一下 add 方法的源码：


  public boolean add(E e) {
    return map.put(e, PRESENT)==null;
  }
  private transient Hash...]]></description><category></category></item><item><title><![CDATA[Set]]></title><link>https://blog.csdn.net/changshu1/article/details/101761065</link><guid>https://blog.csdn.net/changshu1/article/details/101761065</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 11:48:02 +0800</pubDate><description><![CDATA[Set 是一个没有重复元素的集合，允许 null 作为 element。它继承自 Collection 接口，与 Collection 接口相比，几乎没有添加新的函数。因为它只表示一个集合，不需要向 List 一样支持随机访问（get, set），也不需要像 Queue 一样支持队头/队尾部的插入/删除/读取。



参考链接：

1.https://docs.oracle.com/javas...]]></description><category></category></item><item><title><![CDATA[ArrayDeque]]></title><link>https://blog.csdn.net/changshu1/article/details/101760280</link><guid>https://blog.csdn.net/changshu1/article/details/101760280</guid><author>changshu1</author><pubDate>Mon, 30 Sep 2019 11:38:25 +0800</pubDate><description><![CDATA[从名字就能看出来：

1. 实现了 Deque 接口。支持头部/尾部的插入/删除/读取操作。

2. 使用数组实现，如果容量不够，会自动扩容。

下面我们以 add 函数为入口，看一下源码：


  public boolean add(E e) {
    addLast(e);
    return true;
  }
  public void addLast(E...]]></description><category></category></item></channel></rss>