diff --git a/core/includes/common.inc b/core/includes/common.inc
index a518afd..6b5c7c4 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2,6 +2,7 @@
 
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Json;
+use Drupal\Component\Utility\SortArray;
 use Drupal\Component\Utility\String;
 use Drupal\Component\Utility\Tags;
 use Drupal\Component\Utility\Url;
@@ -4210,14 +4211,16 @@ function drupal_render_cid_create($elements) {
  *   that optionally include a '#weight' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @return int
+ *   The comparison result for uasort().
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByWeightProperty()
+ *
+ * @deprecated as of Drupal 8.0. Use SortArray::sortByWeightProperty() instead.
  */
 function element_sort($a, $b) {
-  $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+  return SortArray::sortByWeightProperty($a, $b);
 }
 
 /**
@@ -4232,11 +4235,16 @@ function element_sort($a, $b) {
  *   that optionally include a '#title' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @return int
+ *   The comparison result for uasort().
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByTitleProperty()
+ *
+ * @deprecated as of Drupal 8.0. Use SortArray::sortByTitleProperty() instead.
  */
 function element_sort_by_title($a, $b) {
-  $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
-  $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
-  return strnatcasecmp($a_title, $b_title);
+  return SortArray::sortByTitleProperty($a, $b);
 }
 
 /**
@@ -4294,14 +4302,16 @@ function element_info_property($type, $property_name, $default = NULL) {
  *   element, a default value of 0 will be used.
  * @param $b
  *   Second item for comparison.
+ *
+ * @return int
+ *   The comparison result for uasort().
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByWeightElement()
+ *
+ * @deprecated as of Drupal 8.0. Use SortArray::sortByWeightElement() instead.
  */
-function drupal_sort_weight($a, $b) {
-  $a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['weight'])) ? $b['weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+function drupal_sort_weight(array $a, array $b) {
+  return SortArray::sortByWeightElement($a, $b);
 }
 
 /**
@@ -4314,15 +4324,16 @@ function drupal_sort_weight($a, $b) {
  *   that optionally include a 'title' key.
  * @param $b
  *   Second item for comparison.
+ *
+ * @return int
+ *   The comparison result for uasort().
+ *
+ * @see \Drupal\Component\Utility\SortArray::sortByTitleElement()
+ *
+ * @deprecated as of Drupal 8.0. Use SortArray::sortByTitleElement() instead.
  */
 function drupal_sort_title($a, $b) {
-  if (!isset($b['title'])) {
-    return -1;
-  }
-  if (!isset($a['title'])) {
-    return 1;
-  }
-  return strcasecmp($a['title'], $b['title']);
+  return SortArray::sortByTitleElement($a, $b);
 }
 
 /**
diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php
new file mode 100644
index 0000000..43002f0
--- /dev/null
+++ b/core/lib/Drupal/Component/Utility/SortArray.php
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Component\Utility\SortArray.
+ */
+
+namespace Drupal\Component\Utility;
+
+/**
+ * Provides generic array sorting helper methods.
+ */
+class SortArray {
+
+  /**
+   * Sorts a structured array by the 'weight' element.
+   *
+   * Note that the sorting is by the 'weight' array element, not by the render
+   * element property '#weight'.
+   *
+   * Callback for uasort() used in various functions.
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative
+   *   arrays that optionally include a 'weight' element. For items without a
+   *   'weight' element, a default value of 0 will be used.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public static function sortByWeightElement(array $a, array $b) {
+    $a_weight = isset($a['weight']) ? $a['weight'] : 0;
+    $b_weight = isset($b['weight']) ? $b['weight'] : 0;
+    if ($a_weight === $b_weight) {
+      return 0;
+    }
+    return ($a_weight < $b_weight) ? -1 : 1;
+  }
+
+  /**
+   * Sorts a structured array by '#weight' property.
+   *
+   * Callback for uasort() within element_children().
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative
+   *   arrays that optionally include a '#weight' key.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public static function sortByWeightProperty($a, $b) {
+    $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
+    $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
+    if ($a_weight == $b_weight) {
+      return 0;
+    }
+    return ($a_weight < $b_weight) ? -1 : 1;
+  }
+
+  /**
+   * Sorts a structured array by 'title' key (no # prefix).
+   *
+   * Callback for uasort() within system_admin_index().
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative arrays
+   *   that optionally include a 'title' key.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+  public static function sortByTitleElement($a, $b) {
+    if (!isset($b['title'])) {
+      return -1;
+    }
+    if (!isset($a['title'])) {
+      return 1;
+    }
+    return strcasecmp($a['title'], $b['title']);
+  }
+
+  /**
+   * Sorts a structured array by '#title' property.
+   *
+   * Callback for uasort() within:
+   * - system_modules()
+   * - theme_simpletest_test_table()
+   *
+   * @param array $a
+   *   First item for comparison. The compared items should be associative arrays
+   *   that optionally include a '#title' key.
+   * @param array $b
+   *   Second item for comparison.
+   *
+   * @return int
+   *   The comparison result for uasort().
+   */
+   public static function sortByTitleProperty($a, $b) {
+     $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
+     $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
+     return strnatcasecmp($a_title, $b_title);
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
new file mode 100644
index 0000000..fa2b189
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
@@ -0,0 +1,326 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Component\Utility\SortArrayTest.
+ */
+
+namespace Drupal\Tests\Component\Utility;
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\Component\Utility\SortArray;
+
+/**
+ * Tests the MapArray system.
+ *
+ * @see \Drupal\Component\Utility\SortArray
+ */
+class SortArrayTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'SortArray test',
+      'description' => 'Test that the SortArray functions work properly.',
+      'group' => 'Common',
+    );
+  }
+
+  /**
+   * Tests SortArray::sortByWeightElement() input against expected output.
+   *
+   * @dataProvider providerSortByWeightElement
+   *
+   * @param array $a
+   *   The first input array for the SortArray::sortByWeightElement() method.
+   * @param array $b
+   *   The second input array for the SortArray::sortByWeightElement().
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByWeightElement()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::providersortByWeightElement()
+   */
+  public function testSortByWeightElement($a, $b, $expected) {
+    $result = SortArray::sortByWeightElement($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByWeightElement().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for
+   *   testSortByWeightElement.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByWeightElement()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByWeightElement()
+   */
+  public function providerSortByWeightElement() {
+    $tests = array();
+
+    // Weights set and equal.
+    $tests[] = array(
+      array('weight' => 1),
+      array('weight' => 1),
+      0
+    );
+
+    // Weights set and $a is less (lighter) than $b.
+    $tests[] = array(
+      array('weight' => 1),
+      array('weight' => 2),
+      -1
+    );
+
+    // Weights set and $a is greater (heavier) than $b.
+    $tests[] = array(
+      array('weight' => 2),
+      array('weight' => 1),
+      1
+    );
+
+    // Weights not set.
+    $tests[] = array(
+      array(),
+      array(),
+      0
+    );
+
+    // Weights for $b not set.
+    $tests[] = array(
+      array('weight' => 1),
+      array(),
+      1
+    );
+
+    // Weights for $a not set.
+    $tests[] = array(
+      array(),
+      array('weight' => 1),
+      -1
+    );
+
+    return $tests;
+  }
+
+  /**
+   * Tests SortArray::sortByWeightProperty() input against expected output.
+   *
+   * @dataProvider providerSortByWeightProperty
+   *
+   * @param array $a
+   *   The first input array for the SortArray::sortByWeightProperty() method.
+   * @param array $b
+   *   The second input array for the SortArray::sortByWeightProperty().
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByWeightProperty()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::SortByWeightProperty()
+   */
+  public function testSortByWeightProperty($a, $b, $expected) {
+    $result = SortArray::sortByWeightProperty($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByWeightProperty().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for
+   *   testSortByWeightProperty.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByWeightProperty()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByWeightProperty()
+   */
+  public function providerSortByWeightProperty() {
+    $tests = array();
+
+    // Weights set and equal.
+    $tests[] = array(
+      array('#weight' => 1),
+      array('#weight' => 1),
+      0
+    );
+
+    // Weights set and $a is less (lighter) than $b.
+    $tests[] = array(
+      array('#weight' => 1),
+      array('#weight' => 2),
+      -1
+    );
+
+    // Weights set and $a is greater (heavier) than $b.
+    $tests[] = array(
+      array('#weight' => 2),
+      array('#weight' => 1),
+      1
+    );
+
+    // Weights not set.
+    $tests[] = array(
+      array(),
+      array(),
+      0
+    );
+
+    // Weights for $b not set.
+    $tests[] = array(
+      array('#weight' => 1),
+      array(),
+      1
+    );
+
+    // Weights for $a not set.
+    $tests[] = array(
+      array(),
+      array('#weight' => 1),
+      -1
+    );
+
+    return $tests;
+  }
+
+  /**
+   * Tests SortArray::sortByTitleElement() input against expected output.
+   *
+   * @dataProvider SortByTitleElement
+   *
+   * @param array $a
+   *   The first input item for comparison.
+   * @param array $b
+   *   The second item for comparison.
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByTitleElement()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::SortByTitleElement()
+   */
+  public function testSortByTitleElement($a, $b, $expected) {
+    $result = SortArray::sortByTitleElement($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByTitleElement().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for
+   *   testSortByTitleElement.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByTitleElement()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByTitleElement()
+   */
+  public function SortByTitleElement() {
+    $tests = array();
+
+    // Titles set and equal.
+    $tests[] = array(
+      array('title' => 'test'),
+      array('title' => 'test'),
+      0
+    );
+
+    // Title $a not set.
+    $tests[] = array(
+      array(),
+      array('title' => 'test'),
+      1
+    );
+
+    // Title $b not set.
+    $tests[] = array(
+      array('title' => 'test'),
+      array(),
+      -1
+    );
+
+    // Titles set but not equal.
+    $tests[] = array(
+      array('title' => 'test'),
+      array('title' => 'testing'),
+      -3
+    );
+
+    // Titles set but not equal.
+    $tests[] = array(
+      array('title' => 'testing'),
+      array('title' => 'test'),
+      3
+    );
+
+    return $tests;
+  }
+
+  /**
+   * Tests SortArray::sortByTitleProperty() input against expected output.
+   *
+   * @dataProvider SortByTitleProperty
+   *
+   * @param array $a
+   *   The first input item for comparison.
+   * @param array $b
+   *   The second item for comparison.
+   * @param integer $expected
+   *   The expected output from calling the method.
+   *
+   * @see Drupal\Component\Utility\SortArray::sortByTitleProperty()
+   * @see Drupal\Tests\Component\Utility\SortArrayTest::SortByTitleProperty()
+   */
+  public function testSortByTitleProperty($a, $b, $expected) {
+    $result = SortArray::sortByTitleProperty($a, $b);
+    $this->assertEquals($expected, $result);
+  }
+
+  /**
+   * Data provider for SortArray::sortByTitleProperty().
+   *
+   * @return array
+   *   An array of tests, matching the parameter inputs for
+   *   testSortByTitleProperty.
+   *
+   * @see \Drupal\Component\Utility\SortArray::sortByTitleProperty()
+   * @see \Drupal\Tests\Component\Utility\SortArrayTest::testSortByTitleProperty()
+   */
+  public function SortByTitleProperty() {
+    $tests = array();
+
+    // Titles set and equal.
+    $tests[] = array(
+      array('#title' => 'test'),
+      array('#title' => 'test'),
+      0
+    );
+
+    // Title $a not set.
+    $tests[] = array(
+      array(),
+      array('#title' => 'test'),
+      -4
+    );
+
+    // Title $b not set.
+    $tests[] = array(
+      array('#title' => 'test'),
+      array(),
+      4
+    );
+
+    // Titles set but not equal.
+    $tests[] = array(
+      array('#title' => 'test'),
+      array('#title' => 'testing'),
+      -1
+    );
+
+    // Titles set but not equal.
+    $tests[] = array(
+      array('#title' => 'testing'),
+      array('#title' => 'test'),
+      1
+    );
+
+    return $tests;
+  }
+
+}
